Commit 87ba3ac36f0fa61e43f9bb04d3ad14ef7990d645

Authored by JoenioCosta
1 parent 4025cff3

ActionItem544: autoscroll on edit LinkListBlock

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2186 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/link_list_block.rb
1 1 class LinkListBlock < Block
2 2  
3   - settings_items :title, String
4 3 settings_items :links, Array, :default => []
5 4  
6 5 before_save do |block|
... ...
app/views/box_organizer/_link_list_block.rhtml
1 1 <p>
2   -<label for='block_title'><strong><%= _('Block title') %></strong></label>
3   -<%= text_field_tag 'block[title]', @block.title %>
4   -</p>
5   -
6   -<p>
7 2 <strong><%= _('Links') %></strong>
8 3 <div id='edit-link-list-block'>
9 4 <table id='links' class='noborder'>
... ... @@ -14,14 +9,11 @@
14 9 <td class='cel-address'><%= text_field_tag 'block[links][][address]', link[:address] %></td>
15 10 </tr>
16 11 <% end %>
17   - <tr>
18   - <td><%= text_field_tag 'block[links][][name]' %></td>
19   - <td class='cel-address'><%= text_field_tag 'block[links][][address]' %></td>
20   - </tr>
21 12 </table>
22 13 </div>
23 14 </p>
24 15  
25 16 <%= link_to_function(_('New link'), nil, :class => 'button icon-add with-text') do |page|
26   - page.insert_html :bottom, 'links', content_tag('tr', content_tag('td',text_field_tag('block[links][][name]')) + content_tag('td',text_field_tag('block[links][][address]', nil, :class => 'cel-address')))
  17 + page.insert_html :bottom, 'links', content_tag('tr', content_tag('td',text_field_tag('block[links][][name]')) + content_tag('td',text_field_tag('block[links][][address]', nil, :class => 'cel-address'))) +
  18 + javascript_tag("$('edit-link-list-block').scrollTop = $('edit-link-list-block').scrollHeight")
27 19 end %>
... ...
public/stylesheets/blocks/link-list-block.css
  1 +#edit-link-list-block {
  2 + overflow: auto;
  3 + overflow-x: hidden;
  4 + height: 120px;
  5 +}
  6 +
  7 +#edit-link-list-block table {
  8 + width: 100%;
  9 +}
  10 +
  11 +#edit-link-list-block table .cel-address {
  12 + width: 300px;
  13 +}
  14 +
  15 +#edit-link-list-block table .cel-address input {
  16 + width: 100%;
  17 +}
  18 +
1 19 #content .link-list-block {
2 20 padding: 10px 20px 10px 10px;
3 21  
... ...
public/stylesheets/common.css
... ... @@ -244,24 +244,6 @@ table.noborder th, table.noborder td{
244 244 border: none;
245 245 }
246 246  
247   -#edit-link-list-block {
248   - overflow: auto;
249   - overflow-x: hidden;
250   - height: 120px;
251   -}
252   -
253   -#edit-link-list-block table {
254   - width: 100%;
255   -}
256   -
257   -#edit-link-list-block table .cel-address {
258   - width: 300px;
259   -}
260   -
261   -#edit-link-list-block table .cel-address input {
262   - width: 100%;
263   -}
264   -
265 247 /* for fields with auto-completion */
266 248 div.auto-complete {
267 249 display: block;
... ...