Commit a289d28acfb57936634f441727eedb3d1e7ca60f

Authored by Fabio Teixeira
1 parent b15b9498

Link_List_Block_Improvements: Merge request corrections

(ActionItem2582)

Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
app/controllers/box_organizer_controller.rb
... ... @@ -84,7 +84,7 @@ class BoxOrganizerController &lt; ApplicationController
84 84 if request.xhr? and params[:query]
85 85 search = params[:query]
86 86 articles = @profile.articles.find(:all, :conditions=>"name ILIKE '%#{search}%' or path ILIKE '%#{search}%'", :limit=>20)
87   - path_list = articles.map { |content| content.path }
  87 + path_list = articles.map { |content| "/{profile}/"+content.path }
88 88  
89 89 render :json => path_list.to_json
90 90 else
... ...
app/views/box_organizer/_link_list_block.rhtml
... ... @@ -25,7 +25,7 @@
25 25 <%= select_tag('block[links][][target]', options_for_select(LinkListBlock::TARGET_OPTIONS, link[:target])) %>
26 26 </li>
27 27 <li>
28   - <%= button_without_text("", _('Delete'), "#" , :class=>"icon-delete delete-link-list-row") %>
  28 + <%= button_without_text(:delete, _('Delete'), "#" , :class=>"delete-link-list-row") %>
29 29 </li>
30 30 </ul>
31 31 </li>
... ... @@ -42,7 +42,7 @@
42 42 content_tag('li', text_field_tag('block[links][][address]', nil, :class => 'link-address')) +
43 43 content_tag('li', select_tag('block[links][][target]',
44 44 options_for_select(LinkListBlock::TARGET_OPTIONS, '_self'))) +
45   - content_tag('li', button_without_text("", _('Delete'), "#" , :class=>"icon-delete delete-link-list-row")),
  45 + content_tag('li', button_without_text(:delete, _('Delete'), "#" , :class=>"delete-link-list-row")),
46 46 :class=>"link-list-row new_link_row")
47 47 ) +
48 48 javascript_tag("new_link_action()")
... ...
public/javascripts/edit-link-list.js
... ... @@ -23,16 +23,7 @@ function new_link_action(){
23 23  
24 24 jQuery(".delete-link-list-row").click(function(){
25 25 jQuery(this).parent().parent().remove();
26   - });
27   -
28   - jQuery(".link-address").blur(function(){
29   - var value = jQuery(this).val();
30   - var search = /(^$)|(^\/$)|(http|www).*|.*\{profile\}.*|.*(\.com|\.org|\.net|\.edu|\.gov|\.info|\.eu)/;
31   -
32   - if( !search.test(value) ) {
33   - value = "/{profile}/"+value;
34   - jQuery(this).val(value);
35   - }
  26 + return false;
36 27 });
37 28  
38 29 jQuery(document).scrollTop(jQuery('#dropable-link-list').scrollTop());
... ...
public/stylesheets/application.css
... ... @@ -1864,7 +1864,6 @@ a.button.disabled, input.disabled {
1864 1864 position: relative;
1865 1865 left: -24px;
1866 1866 }
1867   -
1868 1867 .link-list-header {
1869 1868 width: 98%;
1870 1869 height: 25px;
... ... @@ -1872,16 +1871,20 @@ a.button.disabled, input.disabled {
1872 1871 margin-bottom: 5px;
1873 1872 cursor: pointer;
1874 1873 }
1875   -
  1874 +.link-list-header li {
  1875 + list-style-type: none;
  1876 + display: inline;
  1877 + font-weight: bold;
  1878 + font-size: 14px;
  1879 + text-align: center;
  1880 +}
1876 1881 #dropable-link-list {
1877 1882 padding-left: 23px;
1878 1883 margin-top: -12px;
1879 1884 }
1880   -
1881 1885 #dropable-link-list li {
1882 1886 list-style-type: none;
1883 1887 }
1884   -
1885 1888 .link-list-row {
1886 1889 line-height: 25px;
1887 1890 margin-bottom: 5px;
... ... @@ -1890,54 +1893,37 @@ a.button.disabled, input.disabled {
1890 1893 width: 90%;
1891 1894 }
1892 1895 .link-list-row:hover {
1893   - background: #aaa url(/images/drag-and-drop.png) no-repeat;
  1896 + background: #ddd url(/images/drag-and-drop.png) no-repeat;
1894 1897 background-position: 98% 15px;
1895 1898 }
1896   -
1897 1899 .link-list-row li {
1898 1900 list-style-type: none;
1899 1901 display: inline;
1900 1902 margin-left: 5px;
1901 1903 }
1902   -
1903 1904 .link-list-row li div {
1904 1905 float: left;
1905 1906 margin-top: 4px;
1906 1907 }
1907   -
1908 1908 .link-list-row li a {
1909 1909 line-height: 27px !important;
1910 1910 padding-right: 5px;
1911 1911 }
1912   -
1913   -.link-list-header li {
1914   - list-style-type: none;
1915   - display: inline;
1916   - font-weight: bold;
1917   - font-size: 14px;
1918   - text-align: center;
1919   -}
1920   -
1921 1912 .link-list-icon {
1922 1913 margin-left: 14px;
1923 1914 }
1924   -
1925 1915 .link-list-name {
1926 1916 margin-left: 40px;
1927 1917 }
1928   -
1929 1918 .link-list-address {
1930 1919 margin-left: 90px;
1931 1920 }
1932   -
1933 1921 .link-list-target {
1934 1922 margin-left: 77px;
1935 1923 }
1936   -
1937 1924 .new_link_row li {
1938 1925 margin-left: 7px;
1939 1926 }
1940   -
1941 1927 #content .link-list-block {
1942 1928 padding: 10px 0px 10px 10px;
1943 1929 }
... ...
test/functional/profile_design_controller_test.rb
... ... @@ -326,10 +326,13 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase
326 326 article3 = fast_create(Article, :profile_id => @profile.id, :name => "Not an article")
327 327  
328 328 xhr :get, :search_autocomplete, :profile => 'designtestuser' , :query => 'Some'
  329 +
  330 + json_response = ActiveSupport::JSON.decode(@response.body)
  331 +
329 332 assert_response :success
330   - assert_equal @response.body.include?(article1.path), true
331   - assert_equal @response.body.include?(article2.path), true
332   - assert_equal @response.body.include?(article3.path), false
  333 + assert_equal json_response.include?("/{profile}/"+article1.path), true
  334 + assert_equal json_response.include?("/{profile}/"+article2.path), true
  335 + assert_equal json_response.include?("/{profile}/"+article3.path), false
333 336 end
334 337  
335 338 ######################################################
... ...