Changeset 1055
- Timestamp:
- 2008-06-10 15:11:34 (7 months ago)
- Files:
-
- trunk/app/views/nodes/edit.rjs (modified) (1 diff)
- trunk/app/views/nodes/update.rjs (modified) (1 diff)
- trunk/db/init/base/skins/default/Node.zafu (modified) (2 diffs)
- trunk/db/init/base/skins/default/Project.zafu (modified) (1 diff)
- trunk/db/init/base/skins/default/notes.zafu (modified) (1 diff)
- trunk/db/init/base/skins/default/style.css (modified) (3 diffs)
- trunk/lib/parser/lib/parser.rb (modified) (1 diff)
- trunk/lib/parser/lib/rules/zafu.rb (modified) (1 diff)
- trunk/lib/parser/lib/rules/zena.rb (modified) (7 diffs)
- trunk/lib/parser/test/parser/zafu.yml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/views/nodes/edit.rjs
r857 r1055 4 4 page << "$('node_#{params[:attribute]}').select();" 5 5 else 6 page.replace "#{ dom_id_from_template_url}.#{@node[:zip]}", :file => fullpath_from_template_url + "_form.erb"6 page.replace "#{params[:dom_id]}", :file => fullpath_from_template_url + "_form.erb" 7 7 end trunk/app/views/nodes/update.rjs
r918 r1055 1 1 if @errors || !@node.errors.empty? 2 2 if @update == 'zafu' 3 page.replace "#{ dom_id_from_template_url}.#{@node[:zip]}", :file => fullpath_from_template_url + "_form.erb"3 page.replace "#{params[:dom_id]}", :file => fullpath_from_template_url + "_form.erb" 4 4 else 5 5 # TODO: is this used ? how ? when ? trunk/db/init/base/skins/default/Node.zafu
r1032 r1055 19 19 <div id='login' do='login_link'/> 20 20 <div id='visitor' do='visitor_link'/> 21 <div id='search' do='search_box' />21 <div id='search' do='search_box' type='search'/> 22 22 <ol id='menu' do='root' do='pages'> 23 23 <li do='each' on_if_node='ancestor' do='link'/> … … 80 80 </ol> 81 81 </r:references> 82 82 83 83 </div> 84 84 <div id='main'> trunk/db/init/base/skins/default/Project.zafu
r1010 r1055 1 1 <r:include template='Node'> 2 <r:with part='content'> 2 <r:with part='context'/> 3 <r:with part='content' class='project'> 3 4 <r:include template='Node' part='related'/> 4 < div id='main' do='text'/>5 <r:text/> 5 6 <r:include template='notes'/> 6 7 </r:with> trunk/db/init/base/skins/default/notes.zafu
r1032 r1055 6 6 <p class='node_v_title'><input type='text' name='v_title' size='25'/></p> 7 7 <p class='node_klass'> <r:select name='klass' root_class='Note' selected='Post'/></p> 8 <p class='node_log_at'> <input type='date_box' name='log_at'/> < r:checkbox role='blog' values='11'/></p>8 <p class='node_log_at'> <input type='date_box' name='log_at'/> </p> 9 9 <p class='validate'> <input type="submit" value='validate' do='void' tset_value='validate'/></p> 10 10 </form> trunk/db/init/base/skins/default/style.css
r1049 r1055 3 3 a.wiki { color:inherit; border-bottom:1px dotted blue;} 4 4 .zazen a:hover, #footer a:hover { border-bottom:1px solid blue;} 5 input { padding:3px 4px;} 6 5 7 #header, #container, #footer, #top { width:800px; border:1px solid #555; border-width:0 1px 1px; margin:0 auto; background:white; padding:100px 21px;} 6 8 #header { background:orange; padding:7px 21px; position:relative; color:white;} … … 18 20 #title { margin:0 42px 42px 200px; color:black;} 19 21 #title h1 { font-size:35px; margin:0;} 20 .summary p { margin:0; text-style:italic; font-family: Times; font-size:120%;}22 .summary p { margin:0; text-style:italic; font-family:Georgia,Times,serif; color:black;} 21 23 #context { width:180px; float:left; border-right:1px solid grey;} 22 24 ol { padding-left:14px;} 23 25 24 #content { margin-left: 200px;} 26 #content { margin-left: 200px; } 27 #content.project { margin:18px;} 25 28 #related { width:150px; float:right; margin:-7px 0 14px 14px; border:1px dotted #bbb; padding:7px; font-size:12px; line-height:21px; background:#f4f4f4;} 26 29 … … 56 59 57 60 /* notes */ 58 .note { border-bottom:2px solid #bbb; margin:35px 0; padding:0 21px;} 59 .note .log_at { float:right; font-style:italic; color:grey; padding-top:14px;} 60 .note h2.title, .note .header p { margin:0;} 61 .note { border-bottom:1px solid #999; margin:0 0 42px; padding:0;} 62 .note .header p { margin:0;} 63 .note p.log_at { float:right; font-style:italic; color:grey; font-size:14px; line-height:42px; margin-right:10px;} 64 .note h2.title { color:#200; font-size:14px; line-height:42px; font-weight:bold; font-family:Georgia,Times,serif; font-size:24px; line-height:42px;} 65 .note .title a { color:inherit;} 61 66 62 67 .inline_form { margin:2px; padding:3px; border:1px dotted grey; font-size:80%; background:#eed;} trunk/lib/parser/lib/parser.rb
r1034 r1055 127 127 @blocks = obj.blocks.empty? ? @blocks : obj.blocks 128 128 @params = obj.params.empty? ? @params : obj.params 129 @params[:id] = @name130 129 end 131 130 trunk/lib/parser/lib/rules/zafu.rb
r1032 r1055 8 8 def replace_with(new_obj) 9 9 super 10 html_tag_params = new_obj.html_tag_params 11 [:class, :id].each do |sym| 12 html_tag_params[sym] = new_obj.params[sym] if new_obj.params.include?(sym) 13 end 10 14 @html_tag = new_obj.html_tag || @html_tag 11 @html_tag_params = !new_obj.html_tag_params.empty? ? new_obj.html_tag_params : @html_tag_params15 @html_tag_params.merge!(html_tag_params) 12 16 end 13 17 trunk/lib/parser/lib/rules/zena.rb
r1045 r1055 175 175 176 176 res ||= super(method) 177 178 177 "#{pre}#{res}#{post}" 179 178 end … … 650 649 else 651 650 # edit button 651 dom_id = parent.method == 'each' ? @context[:dom_id] : unique_name 652 dom_id = "#{dom_id}.\#{#{node_id}}" 653 654 action = "?template_url=#{CGI.escape(template_url)}" 655 action << "&dom_id=#{dom_id}" 652 656 # TODO: show 'reply' instead of 'edit' in comments if visitor != author 653 "<%= #{node}.can_write? ? link_to_remote(#{text || _('edit').inspect}, {:url => edit_#{base_class.to_s.underscore}_path(#{node_id}) + '?template_url=#{CGI.escape(template_url)}', :method => :get}#{params_to_erb(@params)}) : '' %>"657 "<%= #{node}.can_write? ? link_to_remote(#{text || _('edit').inspect}, {:url => edit_#{base_class.to_s.underscore}_path(#{node_id}) + \"#{action}\", :method => :get}#{params_to_erb(@params)}) : '' %>" 654 658 end 655 659 else … … 997 1001 template_url = get_template_url 998 1002 @html_tag_params ||= {} 999 @html_tag_params[:id] = @html_tag_params[:id] ? CGI.escape(@html_tag_params[:id]) : template_url 1003 dom_id = parent.method == 'each' ? @context[:erb_dom_id] : unique_name 1004 @html_tag_params[:id] = "#{dom_id}.#{erb_node_id}" 1000 1005 @html_tag_params[:class] ||= 'drop' 1001 1006 … … 1040 1045 1041 1046 def r_unlink 1042 text = expand_with1047 text = get_text_for_erb 1043 1048 if text.blank? 1044 1049 text = _('btn_tiny_del') 1045 1050 end 1046 dom_id = "#{CGI.escape(@context[:dom_id])}.\#{#{node_id}}" 1051 #dom_id = "#{@context[:dom_id]}.\#{#{node_id}}" 1052 dom_id = "#{@context[:erb_dom_id]}.#{erb_node_id}" 1047 1053 if node_kind_of?(Node) 1048 out "<% if #{node}[:link_id] -%><%= link_to_remote(#{text.inspect}, {:url => \"/nodes/\#{#{node}[:zip]}/links/\#{#{node}[:link_id]}?remove=#{dom_id}\", :method => :delete}, :class=>#{(@params[:class] || 'unlink').inspect}) %><% end -%>" 1054 out "<% if #{node}[:link_id] -%>" 1055 out "<a class='#{@params[:class] || 'unlink'}' href='/nodes/#{erb_node_id}/links/<%= #{node}[:link_id] %>?remove=#{dom_id}' onclick=\"new Ajax.Request('/nodes/#{erb_node_id}/links/<%= #{node}[:link_id] %>?remove=#{dom_id}', {asynchronous:true, evalScripts:true, method:'delete'}); return false;\">" 1056 if !@blocks.empty? 1057 out expand_with 1058 else 1059 out _('btn_tiny_del') 1060 end 1061 out "</a><% end -%>" 1049 1062 elsif node_kind_of?(DataEntry) 1050 1063 out "<%= link_to_remote(#{text.inspect}, {:url => \"/data_entries/\#{#{node}[:id]}?remove=#{dom_id}\", :method => :delete}, :class=>#{(@params[:class] || 'unlink').inspect}) %>" … … 1151 1164 #dom_id = @context[:template_url] || self.dom_id() 1152 1165 1166 erb_dom_id = "#{self.dom_id}.#{erb_node_id}" 1167 dom_id = "#{self.dom_id}.\#{#{node_id}}" 1168 1153 1169 if @params[:draggable] == 'true' 1154 1170 out "<% #{var}_dom_ids << \"#{dom_id}.\#{#{node_id(var)}}\" -%>" … … 1161 1177 if @context[:template_url] || @params[:draggable] == 'true' || descendant('unlink') 1162 1178 # ajax, set id 1163 id_hash = {:id=> "#{dom_id}.#{erb_node_id(var)}"}1179 id_hash = {:id=> "#{erb_dom_id}.#{erb_node_id(var)}"} 1164 1180 if @html_tag 1165 1181 @html_tag_params.merge!(id_hash) 1166 res = expand_with(:node=>var, :dom_id=>dom_id ) # dom_id is needed by 'unlink'1182 res = expand_with(:node=>var, :dom_id=>dom_id, :erb_dom_id=>erb_dom_id) # dom_id is needed by 'unlink' and 'drop' 1167 1183 else 1168 res = add_params(expand_with(:node=>var, :dom_id=>dom_id ), id_hash)1184 res = add_params(expand_with(:node=>var, :dom_id=>dom_id, :erb_dom_id=>erb_dom_id), id_hash) 1169 1185 end 1170 1186 else … … 1976 1992 1977 1993 def add_params(text, opts={}) 1978 text.sub(/\A([^<]*)<(\w+)( [^>]+|)>/) do1994 text.sub(/\A([^<]*)<(\w+)( .*?)[^%]>/) do 1979 1995 # we must set the first tag id 1980 1996 before = $1 trunk/lib/parser/test/parser/zafu.yml
r1006 r1055 128 128 129 129 named_with_do: 130 src: "named_with_do: <p id='branding' do='void'>...</p>"130 src: "named_with_do: <p id='branding'>...</p>" 131 131 res: "named_with_do: <p id='branding'>...</p>" 132 132 133 133 replace_with_do: 134 src: "replace_with_do: <r:include template='/named/with/do'><r:with part='branding' >lalala</r:with>"135 res: "replace_with_do: named_with_do: <p id='branding'>lalala</p>"134 src: "replace_with_do: <r:include template='/named/with/do'><r:with part='branding' class='goal'>lalala</r:with>" 135 res: "replace_with_do: named_with_do: <p class='goal' id='branding'>lalala</p>" 136 136 137 137 include_part:
