Changeset 1154
- Timestamp:
- 2008-09-15 20:20:44 (4 months ago)
- Files:
-
- trunk/app/helpers/application_helper.rb (modified) (1 diff)
- trunk/app/views/nodes/update.rjs (modified) (1 diff)
- trunk/lib/parser/lib/rules/zena.rb (modified) (3 diffs)
- trunk/test/fixtures/files/Node-test.zafu (modified) (2 diffs)
- trunk/test/helpers/zena_parser/ajax.yml (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/helpers/application_helper.rb
r1134 r1154 18 18 # RJS to update a page after create/update/destroy 19 19 def update_page_content(page, obj) 20 if params[:t_id] && @node.errors.empty? 21 @node = secure(Node) { Node.find_by_zip(params[:t_id])} 22 end 23 20 24 base_class = obj.kind_of?(Node) ? Node : obj.class 21 25 trunk/app/views/nodes/update.rjs
r1098 r1154 1 1 if params[:dom_id] && !params[:t_url] 2 attribute = params[:node].keys[0]2 attribute = (params[:node].keys - ['v_status'])[0] 3 3 if params[:zazen] == 'true' 4 4 page.replace_html params[:dom_id], "<span class='zazen_edit'>#{link_to_remote(_('edit'), :url => edit_node_path(@node[:zip]) + "?attribute=#{attribute}&dom_id=#{params[:dom_id]}#{params[:publish] == 'true' ? '&publish=true' : ''}&zazen=true", :method => :get)}</span>" + zazen(params[:node][attribute]) trunk/lib/parser/lib/rules/zena.rb
r1147 r1154 979 979 980 980 hidden_fields['t_url'] = template_url 981 if t_id = @params[:t_id] 982 hidden_fields['t_id'] = parse_attributes_in_value(t_id) 983 end 981 984 982 985 erb_dom_id = @context[:saved_template] ? '<%= params[:dom_id] %>' : self.erb_dom_id … … 1430 1433 # normal rendering: not the start of a saved template 1431 1434 if is_draggable || descendant('unlink') 1432 @html_tag ||= 'div'1433 1435 out "<% #{var}_dom_ids = [] -%>" 1434 1436 end … … 3156 3158 else 3157 3159 insert = '' 3158 end 3160 end 3161 3162 res = insert + text 3159 3163 3160 3164 if id_hash 3161 if @html_tag 3162 @html_tag_params.merge!(id_hash) 3163 res = insert + text 3164 else 3165 res = add_params(text, id_hash, insert) 3166 end 3167 end 3165 @html_tag ||= 'div' 3166 @html_tag_params.merge!(id_hash) 3167 end 3168 3168 3169 [res, drag_handle] 3169 3170 end trunk/test/fixtures/files/Node-test.zafu
r1147 r1154 117 117 </ul> 118 118 119 <h3>drop reload with param </h3>119 <h3>drop reload with param (comment on receiving)</h3> 120 120 121 121 <div style='border:1px solid #400; min_width:100px; min_height:100px;' do='drop' change='params' d='[id]' do='if' test='param:d'> … … 141 141 <hr/> 142 142 143 <h3>drop reload with param (comment on dropped)</h3> 144 145 <div style='border:1px solid #400; min_width:100px; min_height:100px;' do='drop' change='params' d='[id]' do='if' test='param:d'> 146 <r:node where='id eq param:d' in='site'> 147 Change icon to <r:img mode='tiny'/> ? 148 <r:form t_id='[main.id]'> 149 <r:input type='hidden' name='icon_for_id' set_value='[main.id]'/> 150 <r:input type='hidden' name='m_title' set_value='icon for [main.name]'/> 151 <r:textarea name='m_text'/> 152 <input type='submit'/> 153 </r:form> 154 </r:node> 155 <r:else> 156 please drop a node to change the icon 157 <r:icon><r:img mode='pv'/> 158 <ul do='comments'> 159 <li do='each'><b do='[title]'/> <b do='[author_name]'/> 160 <div do='{text}'/> 161 </li> 162 </ul></r:icon></r:else> 163 </div> 164 165 <hr/> 143 166 <h2>notes & comments</h2> 144 167 trunk/test/helpers/zena_parser/ajax.yml
r1147 r1154 74 74 context: 75 75 node: 'wiki' 76 src: "<r:children>< r:each><li><r:show attr='name'>blah</r:show> <r:edit>edit</r:edit></li>\n</r:each><r:form><li><form>this is the form</form></li></r:form></r:children>"76 src: "<r:children><li do='each'><r:show attr='name'>blah</r:show> <r:edit>edit</r:edit></li>\n<r:form><li><form>this is the form</form></li></r:form></r:children>" 77 77 res: "/<li id='list1_30'>bird <a href='/nodes/30/edit\?t_url=.*' onclick=\"new Ajax.Request\('/nodes/30/edit\?t_url=%2Feach%2Fedit%2Fwith%2Fform%2Flist/" 78 78 … … 87 87 node: 'cleanWater' 88 88 visitor: 'anon' 89 src: "<r:children>< r:each><li><r:show attr='name'>blah</r:show> <r:edit>edit</r:edit></li>\n</r:each></r:children>"89 src: "<r:children><li do='each'><r:show attr='name'>blah</r:show> <r:edit>edit</r:edit></li>\n</r:children>" 90 90 res: "/<li id='list1_24'>lake </li>.*/" 91 91 … … 192 192 tem: "/<div class='drop' id='list1'><%= params\[:d\] %>.*drop\?params\[d\]=%5Bid%5D/" 193 193 194 drop_param_in_each: 195 src: "<r:pages do='each' do='drop' change='params' d='[id]'><r:show param='d'/></r:pages>" 196 tem: "/<div class='drop' id='list1_<%= var1.zip %>'><%= params\[:d\] %>.*drop\?params\[d\]=%5Bid%5D/" 197 194 198 swap_in_each: 195 199 src: "<r:pages><li do='each'><span do='swap' attr='d_status' states='todo,done,alert'/></li></r:pages>"
