Navigation Menu

Skip to content

Commit

Permalink
polished off rule editor update
Browse files Browse the repository at this point in the history
  • Loading branch information
ethn committed Mar 22, 2013
1 parent 8827128 commit aebcaa2
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 199 deletions.
4 changes: 2 additions & 2 deletions app/assets/javascripts/wagn_pack.js.coffee
Expand Up @@ -149,8 +149,8 @@ $(window).ready ->
$(this).notify 'To what Set of cards does this Rule apply?'
false

$('body').delegate '.rule-cancel-button', 'click', ->
$(this).closest('tr').find('.close-rule-link').click()
# $('body').delegate '.rule-cancel-button', 'click', ->
# $(this).closest('tr').find('.close-rule-link').click()


# etherpad pack
Expand Down
16 changes: 3 additions & 13 deletions app/assets/stylesheets/card.css
Expand Up @@ -548,21 +548,11 @@ div.search-result-list .search-result-item {

/*------- permissions ------------------*/

table.perm-editor th {
text-align: left;
padding-left: 20px;
background-color: inherit;
border: 0;
color: #666;
}
table.perm-editor td {
padding: 5px;
vertical-align: top;
}
table.perm-editor .pointer-item-text {
width: 200px;
.perm-group h5 {
margin-top: 0px;
}


/*---------- comment-box -------------------------------------- */
.comment-box textarea {
margin-bottom:5px;
Expand Down
25 changes: 15 additions & 10 deletions app/assets/stylesheets/settings.css
Expand Up @@ -26,7 +26,7 @@
td.rule-setting {
width: 30%;
}
.closed-rule .rule-set {
.rule-set {
color: #666;
white-space: nowrap;
}
Expand All @@ -40,6 +40,7 @@ td.rule-setting {
.closed-rule td {
vertical-align: middle;
}
.rule-placeholder,
.closed-rule .rule-content {
width: 350px;
}
Expand All @@ -60,33 +61,37 @@ td.missing-rule {
background-color: #eee;
border-bottom: 1px solid #fff;
}

.open-rule .rule-setting {
.show-rule div.rule-setting,
.edit-rule .rule-setting {
padding-top: 4px;
float: left;
width: 30%;
}
.rule-placeholder {
float: left;
}
.open-rule .card-editor {
.show-rule .card-body,
.edit-rule .card-editor {
clear: both;
padding: 5px;
}

.open-rule .set-editor ul {
.edit-rule .set-editor ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.open-rule .set-editor .current-set-label {
.edit-rule .set-editor .current-set-label {
font-weight: bold;
}
.open-rule .edit-button-area {
.edit-rule .edit-button-area {
clear:both;
padding-top: 5px;
}
.open-rule .instruction {
.edit-rule .instruction {
float: right;
max-width: 70%;
}


.attention {
border: 3px solid red;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/wagn/renderer/html.rb
Expand Up @@ -76,7 +76,7 @@ class Renderer::Html < Renderer
{ :view=>:edit_type, :text=>'type: %{type}' },
{ :related=>{ :name=>:structure, :view=>:edit }, :text=>'structure', :if=>:structure },
] },
{ :view=>:self, :text=>'view', :sub=> [
{ :view=>:home, :text=>'view', :sub=> [
{ :view=>:home, :text=>'refresh' },
{ :page=>:self, :text=>'page' },
{ :view=>:changes, :text=>'history', :if=>:edit },
Expand Down
12 changes: 5 additions & 7 deletions lib/wagn/set/all/rich_html.rb
Expand Up @@ -329,17 +329,15 @@ module Set::All::RichHtml
define_view :edit_in_form, :perms=>:update, :tags=>:unknown_ok do |args|
eform = form_for_multi
content = content_field eform, :nested=>true
attribs = { :class=> "card-editor RIGHT-#{ card.cardname.tag_name.safe_key }" }
link_target, help_settings = if card.new_card?
opts = { :attribs => { :class=> "card-editor RIGHT-#{ card.cardname.tag_name.safe_key }" } }
if card.new_card?
content += raw( "\n #{ eform.hidden_field :type_id }" )
[ card.cardname.tag, [:add_help, { :fallback => :edit_help } ] ]
opts[:help] = [:add_help, { :fallback => :edit_help } ]
else
attribs.merge :card_id=>card.id, :card_name=>(h card.name)
[ card.name, :edit_help ]

opts[:help] = :edit_help
end
label = link_to_page fancy_title, link_target
fieldset label, content, :help=>help_settings, :attribs=>attribs
fieldset fancy_title, content, opts
end


Expand Down
69 changes: 35 additions & 34 deletions lib/wagn/set/right/permissions.rb
Expand Up @@ -16,41 +16,42 @@ module Set::Right::Permissions

item_names = inheriting ? [] : card.item_names

form.hidden_field( :content, :class=>'card-content') +

content_tag(:table, :class=>'perm-editor') do

content_tag(:tr, :class=>'perm-labels') do
content_tag(:th) { 'Groups'} +
content_tag(:th) { 'Individuals'} +
(inheritable ? content_tag(:th) { 'Inherit'} : '')
end +

content_tag(:tr, :class=>'perm-options') do
content_tag(:td, :class=>'perm-group perm-vals') do
group_options.map do |option|
checked = !!item_names.delete(option.name)
%{<div class="group-option">
#{ check_box_tag( "#{option.key}-perm-checkbox", option.name, checked, :class=>'perm-checkbox-button' ) }
<label>#{ link_to_page option.name }</label>
</div>}
end * "\n"
end +

content_tag(:td, :class=>'perm-indiv perm-vals') do
_render_list :items=>item_names, :extra_css_class=>'perm-indiv-ul'
end +

if inheritable
content_tag(:td, :class=>'perm-inherit') do
check_box_tag( 'inherit', 'inherit', inheriting ) +
content_tag(:a, :title=>"use #{card.cardname.tag} rule for left card") { '?' }
%{
#{ form.hidden_field :content, :class=>'card-content' }
<div class="perm-editor">
<div class="perm-group perm-vals">
<h5>Groups</h5>
#{
group_options.map do |option|
checked = !!item_names.delete(option.name)
%{
<div class="group-option">
#{ check_box_tag( "#{option.key}-perm-checkbox", option.name, checked, :class=>'perm-checkbox-button' ) }
<label>#{ link_to_page option.name }</label>
</div>
}
end * "\n"
}
</div>
<div class="perm-indiv perm-vals">
<h5>Individuals</h5>
#{ _render_list :items=>item_names, :extra_css_class=>'perm-indiv-ul' }
</div>
#{
if inheritable
%{
<h5>Inheritance</h5>
#{ check_box_tag 'inherit', 'inherit', inheriting }
#{ content_tag( :a, :title=>"use #{card.cardname.tag} rule for left card") { '?' } }
}
end
else; ''; end
end
end


}
</div>
}
end

define_view :core, { :right=>'create'} do |args|
Expand Down

0 comments on commit aebcaa2

Please sign in to comment.