Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

made set patterns packable

  • Loading branch information...
commit f46e686617a9644eba4ad052b0da50d55f22b9f6 1 parent bb27e9c
Ethan McCutchen ethn authored
4 app/assets/stylesheets/card.css
View
@@ -25,10 +25,12 @@ html>body .open-view {
.card-slot > .instruction {
background: #eee;
}
-
.card-body {
padding: 5px 1.5%;
}
+.card-frame .card-body {
+ min-height: 20px;
+}
/*----- header ---------*/
2  lib/cardlib/fetch.rb
View
@@ -158,7 +158,7 @@ def fetch opts={}
def renew args={}
if opts = args[:new]
- opts[:name] ||= cardname
+ opts[:name] = cardname
opts[:skip_modules] = args[:skip_modules]
Card.new opts
end
40 lib/cardlib/pattern.rb
View
@@ -3,8 +3,8 @@ module Pattern
mattr_accessor :subclasses
@@subclasses = []
- def self.register_class klass
- @@subclasses.unshift klass
+ def self.register_class klass, index=nil
+ @@subclasses.insert index.to_i, klass
end
def self.method_key opts
@@ -27,7 +27,6 @@ def self.find_class mark
end
end
-
def reset_patterns_if_rule saving=false
if is_rule?
set = left
@@ -55,7 +54,7 @@ def patterns_with_new
alias_method_chain :patterns, :new
def safe_keys
- patterns.map(&:safe_key).reverse*" "
+ patterns.map( &:safe_key ).reverse * " "
end
def set_modules
@@ -123,7 +122,7 @@ def key_name
end
def register key, opt_keys, opts={}
- Cardlib::Pattern.register_class self
+ Cardlib::Pattern.register_class self, opts.delete(:index)
self.key = key
self.key_id = Wagn::Codename[key]
self.opt_keys = Array===opt_keys ? opt_keys : [opt_keys]
@@ -219,19 +218,19 @@ def rule_set_key
class AllPattern < BasePattern
register 'all', [], :method_key=>''
def self.label(name) 'All cards' end
- def self.prototype_args(base) {} end
+ def self.prototype_args(anchor) {} end
end
class AllPlusPattern < BasePattern
register 'all_plus', :all_plus, :method_key=>'all_plus', :junction_only=>true
def self.label(name) 'All "+" cards' end
- def self.prototype_args(base) {:name=>'+'} end
+ def self.prototype_args(anchor) {:name=>'+'} end
end
class TypePattern < BasePattern
register 'type', :type
def self.label name; %{All "#{name}" cards} end
- def self.prototype_args base; {:type=>base} end
+ def self.prototype_args anchor; {:type=>anchor} end
def self.pattern_applies? card; !!card.type_id end
def self.anchor_name card; card.type_name end
def self.anchor_id card; card.type_id end
@@ -240,22 +239,22 @@ def self.anchor_id card; card.type_id end
class StarPattern < BasePattern
register 'star', :star, :method_key=>'star'
def self.label name; 'All "*" cards' end
- def self.prototype_args base; {:name=>'*dummy'} end
+ def self.prototype_args anchor; {:name=>'*dummy'} end
def self.pattern_applies? card; card.cardname.star? end
end
class RstarPattern < BasePattern
register 'rstar', :rstar, :method_key=>'rstar', :junction_only=>true
def self.label name; 'All "+*" cards' end
- def self.prototype_args base; { :name=>'*dummy+*dummy'} end
+ def self.prototype_args anchor; { :name=>'*dummy+*dummy'} end
def self.pattern_applies? card; card.cardname.rstar? end
end
class RightPattern < BasePattern
register 'right', :right, :junction_only=>true, :assigns_type=>true
- def self.label name; %{All "+#{name}" cards} end
- def self.prototype_args base; {:name=>"*dummy+#{base}"} end
- def self.anchor_name card; card.cardname.tag end
+ def self.label name; %{All "+#{name}" cards} end
+ def self.prototype_args anchor; {:name=>"*dummy+#{anchor}"} end
+ def self.anchor_name card; card.cardname.tag end
end
class LeftTypeRightNamePattern < BasePattern
@@ -264,9 +263,9 @@ class << self
def label name
%{All "+#{name.to_name.tag}" cards on "#{name.to_name.left_name}" cards}
end
- def prototype_args base
- { :name=>"*dummy+#{base.tag}",
- :loaded_left=> Card.new( :name=>'*dummy', :type=>base.trunk_name )
+ def prototype_args anchor
+ { :name=>"*dummy+#{anchor.tag}",
+ :loaded_left=> Card.new( :name=>'*dummy', :type=>anchor.trunk_name )
}
end
def anchor_name card
@@ -280,10 +279,11 @@ def anchor_name card
class SelfPattern < BasePattern
register 'self', :name
#note: does not assign type bc this causes trouble when cardtype cards have a *self set.
- def self.label name; %{The card "#{name}"} end
- def self.prototype_args base; { :name=>base } end
- def self.anchor_name card; card.name end
- def self.anchor_id card; card.id end
+ def self.label name; %{The card "#{name}"} end
+ def self.prototype_args anchor; { :name=>anchor } end
+ def self.anchor_name card; card.name end
+ def self.anchor_id card; card.id end
end
+
end
end
1  lib/wagn/renderer/html.rb
View
@@ -75,6 +75,7 @@ class Renderer::Html < Renderer
{ :view=>:edit_name, :text=>'name' },
{ :view=>:edit_type, :text=>'type: %{type}' },
{ :related=>{ :name=>:structure, :view=>:edit }, :text=>'structure', :if=>:structure },
+# { :view=>:edit_type, :text=>'type: %{type}' },
] },
{ :view=>:home, :text=>'view', :sub=> [
{ :view=>:home, :text=>'refresh' },
1  lib/wagn/set/right/rstar.rb
View
@@ -93,6 +93,7 @@ module Set::Rstar
end
%{
+
<tr class="card-slot #{rule_view.to_s.sub '_', '-'}">
<td class="rule-cell" colspan="3">
#{ subrenderer( current_rule )._render rule_view, opts }
2  lib/wagn/set/type/layout_type.rb
View
@@ -5,7 +5,7 @@ module Set::Type::LayoutType
format :base
define_view :editor, :type=>:layout_type do |args|
- form.text_area :content, :rows=>30, :class=>'card-content'
+ form.text_area :content, :rows=>15, :class=>'card-content'
end
define_view :core, :type=>:layout_type do |args|
2  lib/wagn/set/type/plaintext_phrase_html_and_number.rb
View
@@ -17,7 +17,7 @@ module Set::Type::PlaintextPhraseHtmlAndNumber
end
define_view :editor, :type=>'html' do |args|
- form.text_area :content, :rows=>30, :class=>'card-content'
+ form.text_area :content, :rows=>15, :class=>'card-content'
end
define_view :closed_content, :type=>'html' do |args|
4 lib/wagn/sets.rb
View
@@ -51,8 +51,8 @@ def namespace spc, &block
class << self
def load_cardlib ; load_dir File.expand_path( CARDLIB, __FILE__ ) end
def load_renderers; load_dir File.expand_path( RENDERERS, __FILE__ ) end
- def dir newdir ; @@dirs << newdir end
- def load_dirs ; @@dirs.each { |dir| load_dir dir } end
+ #def dir newdir ; @@dirs << newdir end
+ #def load_dirs ; @@dirs.each { |dir| load_dir dir } end
def load_sets
[ SETS, Wagn::Conf[:pack_dirs].split( /,\s*/ ) ].flatten.each do |dirname|
2  spec/lib/wagn/renderer_spec.rb
View
@@ -456,7 +456,7 @@
end
it "should have special editor" do
- assert_view_select render_editor('Html'), 'textarea[rows="30"]'
+ assert_view_select render_editor('Html'), 'textarea[rows="15"]'
end
it "should not render any content in closed view" do
Please sign in to comment.
Something went wrong with that request. Please try again.