Permalink
Browse files

rules withing sets now link to settings

  • Loading branch information...
1 parent 8c28878 commit c4974ed8bedc2270417016bed48172aee7daa67e @ethn ethn committed Mar 31, 2013
View
2 app/assets/stylesheets/card.css
@@ -426,7 +426,7 @@ body#wagn .card-slot.recent-changes h2 {
margin: 0px;
}
.closed-content img {
- height: 16px;
+ max-height: 16px;
width: auto;
float: none;
padding: 0px;
View
29 app/assets/stylesheets/settings.css
@@ -5,6 +5,8 @@
padding: 5px 15px;
}
*/
+
+
.set-select {
margin: 10px;
}
@@ -73,18 +75,18 @@ td.missing-rule {
.rule-setting {
padding-top: 4px;
}
-.edit-rule .rule-setting {
+.open-rule .rule-setting {
+ width: 28%;
float: left;
- width: 30%;
}
-.rule-placeholder {
- float: left;
-}
-.edit-rule .card-editor {
+.open-rule .card-body {
clear: both;
- padding: 5px;
}
-
+.open-rule .instruction {
+ float: right;
+ text-align: left;
+ max-width: 68%;
+}
.edit-rule .set-editor ul {
list-style-type: none;
margin: 0;
@@ -97,10 +99,6 @@ td.missing-rule {
clear:both;
padding-top: 5px;
}
-.edit-rule .instruction {
- float: right;
- max-width: 70%;
-}
.attention {
border: 3px solid red;
}
@@ -121,3 +119,10 @@ tr.rule-changeover td {
td.rule-anchor {
padding-left: 30px;
}
+a.setting-link {
+ font-style: italic;
+ margin-left: 2%;
+ font-weight: normal;
+ color: #000;
+ white-space: nowrap;
+}
View
59 lib/wagn/set/right/rstar.rb
@@ -94,41 +94,39 @@ module Set::Rstar
%{
- <tr class="card-slot #{rule_view.to_s.sub '_', '-'}">
+ <tr class="card-slot open-rule #{rule_view.to_s.sub '_', '-'}">
<td class="rule-cell" colspan="3">
- #{ subrenderer( current_rule )._render rule_view, opts }
+ <div class="rule-setting">
+ #{ link_to_view setting_name.sub(/^\*/,''), :closed_rule, :class=>'close-rule-link slotter' }
+ #{ link_to_page "all rules", setting_name, :class=>'setting-link', :target=>'wagn_setting' }
+ </div>
+
+ <div class="instruction rule-instruction">
+ #{ process_content "{{#{setting_name}+*right+*edit help}}" }
+ </div>
+
+ <div class="card-body">
+ #{ subrenderer( current_rule )._render rule_view, opts }
+ </div>
</td>
</tr>
}
end
define_view :show_rule, :rstar=>true, :tags=>:unknown_ok do |args|
- setting_name = args[:setting_name]
- args[:item] ||= :link
-
- %{
- <div class="rule-setting">
- #{ link_to_view args[:setting_name].sub(/^\*/,''), :closed_rule,
- :class=>'close-rule-link slotter', :path_opts=>{ :card=>args[:open_rule] } }
- </div>
-
- <div class="card-body">
- #{
- if !card.new_card?
- set = card.trunk
- %{
- <div class="rule-set">
- <label>Applies to</label> #{ link_to_page set.label, set.name }:
- </div>
- #{ _render_core args }
- }
- else
- 'No Current Rule'
- end
- }
- </div>
- }
+ if !card.new_card?
+ set = card.trunk
+ args[:item] ||= :link
+ %{
+ <div class="rule-set">
+ <label>Applies to</label> #{ link_to_page set.label, set.name }:
+ </div>
+ #{ _render_core args }
+ }
+ else
+ 'No Current Rule'
+ end
end
define_view :edit_rule, :rstar=>true, :tags=>:unknown_ok do |args|
@@ -142,13 +140,6 @@ module Set::Rstar
%{
#{ hidden_field_tag( :success, open_rule.name ) }
#{ hidden_field_tag( :view, 'open_rule' ) }
- <div class="rule-setting">
- #{ link_to_view setting_name.sub(/^\*/,''), :closed_rule, :class=>'close-rule-link slotter', :path_opts=>{ :card=>open_rule } }
- </div>
-
- <div class="instruction rule-instruction">
- #{ process_content "{{#{setting_name}+*right+*edit help}}" }
- </div>
<div class="card-editor">
#{ fieldset 'type', ( editor_wrap 'type' do
View
8 spec/lib/cardlib/setting_spec.rb
@@ -38,12 +38,12 @@
describe ".related_sets" do
it "should have 2 sets (self and right) for a simple card" do
- sets = Card['A'].related_sets
+ sets = Card['A'].related_sets.map { |s| s[0] }
sets.should == ['A+*self', 'A+*right']
end
it "should have 3 sets (self, type, and right) for a cardtype card" do
- sets = Card['Cardtype A'].related_sets
- sets.should == ['Cardtype A+*self', 'Cardtype A+*type', 'Cardtype A+*right']
+ sets = Card['Cardtype A'].related_sets.map { |s| s[0] }
+ sets.should == ['Cardtype A+*type', 'Cardtype A+*self', 'Cardtype A+*right']
end
# it "should show type plus right sets when they exist" do
# Account.as_bot { Card.create :name=>'Basic+A+*type plus right', :content=>'' }
@@ -56,7 +56,7 @@
# sets.should == ['Cardtype A+*self', 'Cardtype A+*type', 'Cardtype A+*right', 'Basic+Cardtype A+*type plus right']
# end
it "should have sets for a non-simple card" do
- sets = Card['A+B'].related_sets
+ sets = Card['A+B'].related_sets.map { |s| s[0] }
sets.should == ['A+B+*self']
end
end
View
4 spec/lib/wagn/renderer_spec.rb
@@ -204,8 +204,8 @@
r = Wagn::Renderer.new(Card.fetch('*read+*right+*input',:new=>{})).render_open_rule
r.should_not match(/error/i)
r.should_not match('No Card!')
- # warn "r = #{r}"
- assert_view_select r, 'tr[class="card-slot edit-rule"]' do
+ #warn "r = #{r}"
+ assert_view_select r, 'tr[class="card-slot open-rule edit-rule"]' do
assert_select 'input[id="success"][name="success"][type="hidden"][value="*read+*right+*input"]'
end
end

0 comments on commit c4974ed

Please sign in to comment.