summaryrefslogtreecommitdiff
path: root/views/model_policy_edit.haml
blob: 21aea2da5aba429b67d39568adff75ab8ab69431 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
%table{:id => "permissions"}
  %tr
    %td
      -#Model address:
      -#%b= model.web_uri
      -#%br
      Model owner:
      %b= session[:username]
  - if policies.names.empty? != true
    %tr{:id => "info_update"}
      %td
        You share your model with the following group(s). Change settings by choose an option and click on update. You can quit the membership by click on "not set" or allow to predict with your model.
        %a{:href=> "/toxcreate/models"} [exit]
    
    %tr
    - policies.names.each do |n|
      %tr
        %td  
          %b= policies.policies[n].group
          - js = "$('#policy_update_#{model.id}_#{n}').updatePolicy({id: '#{model.id}', mode: 'update', groupname: '#{policies.policies[n].group}', policyname: '#{n}'});\n  "
          :javascript
            $(function() {
              #{js}
            });
          %form{:name => "form_#{n}", :action => url_for("/policy/#{n}"), :method => "post", :enctype => "multipart/form-data", :id => "form_#{n}"}
            %input{:type => 'hidden', :name => 'policyname', :value => n}
            %input{:type => 'hidden', :name => 'id', :id => 'id', :value => model.id}
            %input{:type => 'radio', :name => "select[#{policies.policies[n].group}]", :id => "not#{model.id}_#{n}", :value => "not set", :checked => policies.policies[n].rule.read == nil}
            %label{:for => "not#{model.id}_#{n}"} not set
            %input{:type => 'radio', :name => "select[#{policies.policies[n].group}]", :id => "read#{model.id}_#{n}", :value => "read", :checked => policies.policies[n].rule.read == true}
            %label{:for => "read#{model.id}_#{n}"} read
            %input{:type => 'radio', :name => "select[#{policies.policies[n].group}]", :id => "write#{model.id}_#{n}", :value => "readwrite", :checked => policies.policies[n].rule.readwrite == true}
            %label{:for => "write#{model.id}_#{n}"} read/predict
            %input{ :type => 'submit', :value => "update", :id=> "policy_update_#{model.id}_#{n}", :class => "policy_button"}


  
     
          
  %tr{:id=>"info_add"}
    %td
      Add your model to one or more registered groups to share your model. "read" gives access to data, "read/predict" allows group members to make predictions with your model.
      %a{:href=> "/toxcreate/models"} [exit]
  %tr
  - groups.each do |g|
    %tr
      %td
        %b= g
        - js = "$('#policy_add_#{model.id}_#{g}').addPolicy({id: '#{model.id}', mode: 'add', groupname: '#{g}'});\n  "
        :javascript
          $(function() {
            #{js}
          });
        %form{:name => "form_#{g}", :action => url_for("/policy"), :method => "post", :enctype => "multipart/form-data", :id => "form_#{g}"}
          %input{:type => 'hidden', :name => 'groupname', :value => g}
          %input{:type => 'hidden', :name => 'id', :id => 'id', :value => model.id}
          %input{:type => 'radio', :name => "selection[#{g}]", :id => "not#{model.id}_#{g}", :value => "not set", :checked => "checked"}
          %label{:for => "not#{model.id}_#{g}"} not set
          %input{:type => 'radio', :name => "selection[#{g}]", :id => "read#{model.id}_#{g}", :value => "read"}
          %label{:for => "read#{model.id}_#{g}"} read
          %input{:type => 'radio', :name => "selection[#{g}]", :id => "write#{model.id}_#{g}", :value => "readwrite"}
          %label{:for => "write#{model.id}_#{g}"} read/predict
          %input{ :type => 'submit', :value => "add", :id=> "policy_add_#{model.id}_#{g}", :class => "policy_button", :name => "form_#{g}"}