Commit ac42021dd561b723f14819656927ee20a636710d
Committed by
Daniela Feitosa
1 parent
f99a9e55
Exists in
master
and in
29 other branches
Layouts for wall activities done, scraps missing
Showing
11 changed files
with
106 additions
and
4 deletions
Show diff stats
app/models/event.rb
app/models/forum.rb
| ... | ... | @@ -24,4 +24,13 @@ class Forum < Folder |
| 24 | 24 | def self.icon_name(article = nil) |
| 25 | 25 | 'forum' |
| 26 | 26 | end |
| 27 | + | |
| 28 | + def notifiable? | |
| 29 | + true | |
| 30 | + end | |
| 31 | + | |
| 32 | + def first_paragraph | |
| 33 | + paragraphs = Hpricot(body).search('p') | |
| 34 | + paragraphs.empty? ? '' : paragraphs.first.to_html | |
| 35 | + end | |
| 27 | 36 | end | ... | ... |
app/models/uploaded_file.rb
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | # of the file itself is kept. (FIXME?) |
| 5 | 5 | class UploadedFile < Article |
| 6 | 6 | |
| 7 | - track_actions :upload_image, :after_create, :keep_params => ["view_url", "thumbnail_path", "parent.url", "parent.name"], :if => Proc.new { |a| a.published? && a.image? && !a.parent.nil? && a.parent.gallery? } | |
| 7 | + track_actions :upload_image, :after_create, :keep_params => ["view_url", "thumbnail_path", "parent.url", "parent.name"], :if => Proc.new { |a| a.published? && a.image? && !a.parent.nil? && a.parent.gallery? }, :custom_target => :parent | |
| 8 | 8 | |
| 9 | 9 | include ShortFilename |
| 10 | 10 | ... | ... |
app/views/profile/_create_article.rhtml
| ... | ... | @@ -2,8 +2,10 @@ |
| 2 | 2 | <%= link_to(profile_image(activity.user, :minor), activity.user.url) %> |
| 3 | 3 | </div> |
| 4 | 4 | <div class='profile-activity-description'> |
| 5 | - <p class='profile-activity-text'><%= link_to activity.user.name, activity.user.url %> <%= describe activity %></p> | |
| 6 | - <div class='profile-activity-lead'><%= image_tag(activity.params['first_image']) if activity.params['first_image'] %><%= strip_tags(activity.params['lead']).gsub(/(\xA0|\xC2|\s)+/, ' ').gsub(/^\s+/, '') %></div> | |
| 5 | + <p class='profile-activity-text'><%= link_to activity.user.name, activity.user.url %></p> | |
| 6 | + <div class='profile-activity-lead'> | |
| 7 | + <b><%= activity.params['name'] %></b> <span title='<%= activity.target.class.short_description %>' class='profile-activity-icon icon-new icon-new<%= activity.target.class.icon_name %>'></span><br /> | |
| 8 | + <%= image_tag(activity.params['first_image']) unless activity.params['first_image'].blank? %><%= strip_tags(activity.params['lead']).gsub(/(\xA0|\xC2|\s)+/, ' ').gsub(/^\s+/, '') %> <small><%= link_to(_('See more +'), activity.params['url']) unless activity.get_lead.blank? %></small></div> | |
| 7 | 9 | <p class='profile-activity-time'><%= time_ago_as_sentence(activity.created_at) + ' ' + _('ago') %></p> |
| 8 | 10 | <div class='profile-wall-actions'> |
| 9 | 11 | <%= link_to_remote(content_tag(:span, _('Remove')), :url =>{:action => 'remove_activity', :activity_id => activity.id}, :update => "profile-activity-item-#{activity.id}") if logged_in? && current_person == @profile %> | ... | ... |
config/initializers/action_tracker.rb
| ... | ... | @@ -23,7 +23,7 @@ ActionTrackerConfig.verbs = { |
| 23 | 23 | }, |
| 24 | 24 | |
| 25 | 25 | :upload_image => { |
| 26 | - :description => lambda { n_('uploaded 1 image:<br />%{thumbnails}<br />%{details}', 'uploaded %{num} images:<br />%{thumbnails}<br />%{details}', get_view_url.size) % { :num => get_view_url.size, :thumbnails => '{{ta.collect_group_with_index(:thumbnail_path){ |t,i| content_tag(:span, link_to(image_tag(t), ta.get_view_url[i]))}.last(3).join}}', :details => '{{unique_with_count(ta.collect_group_with_index(:parent_name){ |n,i| link_to(n, ta.get_parent_url[i])}, "%s").join("<br />")}}' % _("in the gallery") } }, | |
| 26 | + :description => lambda { n_('uploaded 1 image:<br />%{thumbnails}<br style="clear: both;" />%{details}', 'uploaded %{num} images:<br />%{thumbnails}<br style="clear: both;" />%{details}', get_view_url.size) % { :num => get_view_url.size, :thumbnails => '{{ta.collect_group_with_index(:thumbnail_path){ |t,i| content_tag(:span, image_tag(t) + link_to(nil, ta.get_view_url[i]))}.last(3).join}}', :details => '{{unique_with_count(ta.collect_group_with_index(:parent_name){ |n,i| link_to(n, ta.get_parent_url[i])}, "%s").join("<br />")}}' % _("in the gallery") } }, | |
| 27 | 27 | :type => :groupable |
| 28 | 28 | }, |
| 29 | 29 | ... | ... |
732 Bytes
public/stylesheets/application.css
| ... | ... | @@ -5911,6 +5911,65 @@ h1#agenda-title { |
| 5911 | 5911 | color: #808080; |
| 5912 | 5912 | } |
| 5913 | 5913 | |
| 5914 | +#profile-wall li.profile-activity-item.upload_image span, | |
| 5915 | +#profile-wall li.profile-activity-item.upload_image span img, | |
| 5916 | +#profile-wall li.profile-activity-item.upload_image span a { | |
| 5917 | + width: 98px; | |
| 5918 | + height: 86px; | |
| 5919 | + display: block; | |
| 5920 | + overflow: hidden; | |
| 5921 | + position: absolute; | |
| 5922 | +} | |
| 5923 | + | |
| 5924 | +#profile-wall li.profile-activity-item.upload_image span { | |
| 5925 | + position: relative; | |
| 5926 | + float: left; | |
| 5927 | + margin: 5px 5px 5px 0; | |
| 5928 | +} | |
| 5929 | + | |
| 5930 | +#profile-wall li.profile-activity-item.upload_image span a { | |
| 5931 | + background: transparent url(/images/gallery-image-activity-border.png) center center no-repeat; | |
| 5932 | + text-indent: -5000em; | |
| 5933 | +} | |
| 5934 | + | |
| 5935 | +#profile-wall li.profile-activity-item.upload_image .article-comment span, | |
| 5936 | +#profile-wall li.profile-activity-item.upload_image .profile-wall-actions span { | |
| 5937 | + display: inline; | |
| 5938 | + position: static; | |
| 5939 | + margin: 0; | |
| 5940 | + float: none; | |
| 5941 | + width: auto; | |
| 5942 | + height: auto; | |
| 5943 | +} | |
| 5944 | + | |
| 5945 | +#profile-wall li.profile-activity-item ul.profile-wall-activities-comments { | |
| 5946 | + margin-top: 0; | |
| 5947 | +} | |
| 5948 | + | |
| 5949 | +#profile-wall li.profile-activity-item.upload_image .profile-activity-text { | |
| 5950 | + padding-left: 50px; | |
| 5951 | +} | |
| 5952 | + | |
| 5953 | +#profile-wall li.profile-activity-item.join_community .profile-activity-text a img, | |
| 5954 | +#profile-wall li.profile-activity-item.new_friendship .profile-activity-text a img { | |
| 5955 | + margin: 5px 5px 0 0; | |
| 5956 | + padding: 1px; | |
| 5957 | + border: 1px solid #ccc; | |
| 5958 | +} | |
| 5959 | + | |
| 5960 | +#profile-wall li.profile-activity-item.create_article { | |
| 5961 | + position: relative; | |
| 5962 | +} | |
| 5963 | + | |
| 5964 | +.profile-activity-icon { | |
| 5965 | + width: 16px; | |
| 5966 | + height: 16px; | |
| 5967 | + display: inline-block; | |
| 5968 | + position: absolute; | |
| 5969 | + top: 5px; | |
| 5970 | + right: 5px; | |
| 5971 | +} | |
| 5972 | + | |
| 5914 | 5973 | #profile-activity .profile-wall-scrap-replies li, |
| 5915 | 5974 | #profile-network .profile-wall-scrap-replies li, |
| 5916 | 5975 | #profile-wall .profile-wall-scrap-replies li { | ... | ... |
test/unit/article_test.rb
| ... | ... | @@ -1600,4 +1600,9 @@ assert_equal 'bla', profile.articles.map(&:comments_count) |
| 1600 | 1600 | a = fast_create(Article, :body => '<p>Foo</p><p>Bar</p>') |
| 1601 | 1601 | assert_equal '', a.first_image |
| 1602 | 1602 | end |
| 1603 | + | |
| 1604 | + should 'store first image in tracked action' do | |
| 1605 | + a = TinyMceArticle.create! :name => 'Tracked Article', :body => '<p>Foo<img src="foo.png" />Bar</p>', :profile_id => profile.id | |
| 1606 | + assert_equal 'foo.png', ActionTracker::Record.last.get_first_image | |
| 1607 | + end | |
| 1603 | 1608 | end | ... | ... |
test/unit/event_test.rb
test/unit/forum_test.rb
| ... | ... | @@ -110,4 +110,17 @@ class ForumTest < ActiveSupport::TestCase |
| 110 | 110 | assert !folder.accept_uploads? |
| 111 | 111 | end |
| 112 | 112 | |
| 113 | + should 'be notifiable' do | |
| 114 | + assert Forum.new.notifiable? | |
| 115 | + end | |
| 116 | + | |
| 117 | + should 'get first paragraph' do | |
| 118 | + f = fast_create(Forum, :body => '<p>First</p><p>Second</p>') | |
| 119 | + assert_equal '<p>First</p>', f.first_paragraph | |
| 120 | + end | |
| 121 | + | |
| 122 | + should 'not get first paragraph' do | |
| 123 | + f = fast_create(Forum, :body => 'Nothing to do here') | |
| 124 | + assert_equal '', f.first_paragraph | |
| 125 | + end | |
| 113 | 126 | end | ... | ... |
test/unit/uploaded_file_test.rb
| ... | ... | @@ -330,4 +330,11 @@ class UploadedFileTest < ActiveSupport::TestCase |
| 330 | 330 | assert_equal 'hello_world.php.txt', file.filename |
| 331 | 331 | end |
| 332 | 332 | |
| 333 | + should 'use the gallery as the parent for action tracker' do | |
| 334 | + p = fast_create(Gallery, :profile_id => @profile.id) | |
| 335 | + f = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :parent => p, :profile => @profile) | |
| 336 | + ta = ActionTracker::Record.last(:conditions => { :verb => "upload_image" }) | |
| 337 | + assert_equal f.parent, ta.target | |
| 338 | + end | |
| 339 | + | |
| 333 | 340 | end | ... | ... |