| rev | 
   line source | 
| 
bsw@194
 | 
     1 local policy = Policy:by_id(param.get_id()) or Policy:new()
 | 
| 
bsw@194
 | 
     2 
 | 
| 
bsw@194
 | 
     3 
 | 
| 
bsw@194
 | 
     4 slot.put_into("title", _"Create / edit policy")
 | 
| 
bsw@194
 | 
     5 
 | 
| 
bsw@194
 | 
     6 
 | 
| 
bsw@194
 | 
     7 slot.select("actions", function()
 | 
| 
bsw@194
 | 
     8   ui.link{
 | 
| 
bsw@194
 | 
     9     attr = { class = { "admin_only" } },
 | 
| 
bsw@194
 | 
    10     text = _"Cancel",
 | 
| 
bsw@194
 | 
    11     module = "admin",
 | 
| 
bsw@194
 | 
    12     view = "policy_list"
 | 
| 
bsw@194
 | 
    13   }
 | 
| 
bsw@194
 | 
    14 end)
 | 
| 
bsw@194
 | 
    15 
 | 
| 
bsw@194
 | 
    16 
 | 
| 
bsw@194
 | 
    17 ui.form{
 | 
| 
bsw@194
 | 
    18   attr = { class = "vertical" },
 | 
| 
bsw@194
 | 
    19   record = policy,
 | 
| 
bsw@194
 | 
    20   module = "admin",
 | 
| 
bsw@194
 | 
    21   action = "policy_update",
 | 
| 
bsw@194
 | 
    22   routing = {
 | 
| 
bsw@194
 | 
    23     default = {
 | 
| 
bsw@194
 | 
    24       mode = "redirect",
 | 
| 
bsw@194
 | 
    25       module = "admin",
 | 
| 
bsw@194
 | 
    26       view = "policy_list"
 | 
| 
bsw@194
 | 
    27     }
 | 
| 
bsw@194
 | 
    28   },
 | 
| 
bsw@194
 | 
    29   id = policy.id,
 | 
| 
bsw@194
 | 
    30   content = function()
 | 
| 
bsw@194
 | 
    31 
 | 
| 
bsw@194
 | 
    32     ui.field.text{ label = _"Index",        name = "index" }
 | 
| 
bsw@194
 | 
    33 
 | 
| 
bsw@194
 | 
    34     ui.field.text{ label = _"Name",        name = "name" }
 | 
| 
bsw@194
 | 
    35     ui.field.text{ label = _"Description", name = "description", multiline = true }
 | 
| 
bsw@194
 | 
    36     ui.field.text{ label = _"Hint",        readonly = true, 
 | 
| 
bsw@194
 | 
    37                     value = _"Interval format:" .. " 3 mons 2 weeks 1 day 10:30:15" }
 | 
| 
bsw@194
 | 
    38 
 | 
| 
bsw@194
 | 
    39     ui.field.text{ label = _"Admission time",     name = "admission_time" }
 | 
| 
bsw@194
 | 
    40     ui.field.text{ label = _"Discussion time",    name = "discussion_time" }
 | 
| 
bsw@194
 | 
    41     ui.field.text{ label = _"Verification time",  name = "verification_time" }
 | 
| 
bsw@194
 | 
    42     ui.field.text{ label = _"Voting time",        name = "voting_time" }
 | 
| 
bsw@194
 | 
    43 
 | 
| 
bsw@194
 | 
    44     ui.field.text{ label = _"Issue quorum numerator",   name = "issue_quorum_num" }
 | 
| 
bsw@194
 | 
    45     ui.field.text{ label = _"Issue quorum denumerator", name = "issue_quorum_den" }
 | 
| 
bsw@194
 | 
    46 
 | 
| 
bsw@194
 | 
    47     ui.field.text{ label = _"Initiative quorum numerator",   name = "initiative_quorum_num" }
 | 
| 
bsw@194
 | 
    48     ui.field.text{ label = _"Initiative quorum denumerator", name = "initiative_quorum_den" }
 | 
| 
bsw@194
 | 
    49 
 | 
| 
bsw@282
 | 
    50     ui.field.text{ label = _"Direct majority numerator",   name = "direct_majority_num" }
 | 
| 
bsw@282
 | 
    51     ui.field.text{ label = _"Direct majority denumerator", name = "direct_majority_den" }
 | 
| 
bsw@282
 | 
    52     ui.field.boolean{ label = _"Strict direct majority", name = "direct_majority_strict" }
 | 
| 
bsw@282
 | 
    53     ui.field.text{ label = _"Direct majority positive",   name = "direct_majority_positive" }
 | 
| 
bsw@282
 | 
    54     ui.field.text{ label = _"Direct majority non negative", name = "direct_majority_non_negative" }
 | 
| 
bsw@194
 | 
    55 
 | 
| 
bsw@282
 | 
    56     ui.field.text{ label = _"Indirect majority numerator",   name = "indirect_majority_num" }
 | 
| 
bsw@282
 | 
    57     ui.field.text{ label = _"Indirect majority denumerator", name = "indirect_majority_den" }
 | 
| 
bsw@282
 | 
    58     ui.field.boolean{ label = _"Strict indirect majority", name = "indirect_majority_strict" }
 | 
| 
bsw@282
 | 
    59     ui.field.text{ label = _"Indirect majority positive",   name = "indirect_majority_positive" }
 | 
| 
bsw@282
 | 
    60     ui.field.text{ label = _"Indirect majority non negative", name = "indirect_majority_non_negative" }
 | 
| 
bsw@282
 | 
    61 
 | 
| 
bsw@282
 | 
    62     ui.field.boolean{ label = _"No reverse beat path", name = "no_reverse_beat_path" }
 | 
| 
bsw@282
 | 
    63     ui.field.boolean{ label = _"No multistage majority", name = "no_multistage_majority" }
 | 
| 
bsw@282
 | 
    64 
 | 
| 
bsw@194
 | 
    65 
 | 
| 
bsw@194
 | 
    66     ui.field.boolean{ label = _"Active?", name = "active" }
 | 
| 
bsw@194
 | 
    67 
 | 
| 
bsw@194
 | 
    68     ui.submit{ text = _"Save" }
 | 
| 
bsw@194
 | 
    69   end
 | 
| 
bsw@194
 | 
    70 }
 |