[Git][noosfero/noosfero][master] 2 commits: Add parent link in article header

Rodrigo Souto gitlab at mg.gitlab.com
Fri Jun 8 11:21:35 BRT 2018


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
cd36fb4e by Iasmin Mendes at 2018-06-08T14:21:30Z
Add parent link in article header

- - - - -
f0c28664 by Rodrigo Souto at 2018-06-08T14:21:30Z
Merge branch 'parent-button' into 'master'

Add parent link in article header

Closes #335

See merge request noosfero/noosfero!1510
- - - - -


8 changed files:

- app/helpers/article_helper.rb
- app/helpers/cms_helper.rb
- app/helpers/content_viewer_helper.rb
- app/views/cms/view.html.erb
- app/views/content_viewer/_article_title.html.erb
- public/designs/themes/base/style.scss
- public/stylesheets/cms.scss
- public/stylesheets/content.scss


Changes:

=====================================
app/helpers/article_helper.rb
=====================================
--- a/app/helpers/article_helper.rb
+++ b/app/helpers/article_helper.rb
@@ -284,4 +284,13 @@ module ArticleHelper
 
     actions << fullscreen_buttons("#article") << report_abuse(profile, :link, @page)
   end
+
+  def path_to_parents(article)
+    path = link_to(article.profile.name, article.profile.url, class: 'path-to-parent')
+    parents = article.hierarchy.select { |parent| parent != article }
+    parents.each do |parent|
+      path += link_to(font_awesome('angle-right', parent.name), parent.url, class: 'path-to-parent')
+    end
+    content_tag(:div, path, class: 'path-to-parents')
+  end
 end


=====================================
app/helpers/cms_helper.rb
=====================================
--- a/app/helpers/cms_helper.rb
+++ b/app/helpers/cms_helper.rb
@@ -1,5 +1,7 @@
 module CmsHelper
 
+  include ArticleHelper
+
   def link_to_new_article(mime_type)
     action = mime_type_to_action_name(mime_type) + '_new'
     button('new', _("New %s") % mime_type, :action => action, :parent_id => params[:parent_id])


=====================================
app/helpers/content_viewer_helper.rb
=====================================
--- a/app/helpers/content_viewer_helper.rb
+++ b/app/helpers/content_viewer_helper.rb
@@ -93,5 +93,4 @@ module ContentViewerHelper
       image_tag("/images/bt-bookmark.gif", :width => 53, :height => 16, :border => 0, :alt => '')
     end
   end
-
 end


=====================================
app/views/cms/view.html.erb
=====================================
--- a/app/views/cms/view.html.erb
+++ b/app/views/cms/view.html.erb
@@ -3,16 +3,11 @@
 <h1>
   <%= _('Content management') %>
 </h1>
+<% if @article %>
+  <%= path_to_parents @article %>
+<% end %>
 
 <div class="cms-header">
-  <div id='article-full-path'>
-    <% if @article %>
-      <%= link_to profile.identifier, :action => 'index' %>
-      <% @article.hierarchy.each do |item| %>
-        <%= font_awesome('long-arrow-alt-right') + ((item == @article) ? item.name.html_safe : link_to(item.slug, :id => item.id).html_safe) %>
-      <% end %>
-    <% end %>
-  </div>
 
   <%= button_bar do %>
     <% parent_id = ((@article && @article.allow_children?) ? @article : nil) %>


=====================================
app/views/content_viewer/_article_title.html.erb
=====================================
--- a/app/views/content_viewer/_article_title.html.erb
+++ b/app/views/content_viewer/_article_title.html.erb
@@ -19,5 +19,6 @@
   <h1 class="title">
     <%= h(@page.title) %>
   </h1>
+  <%= path_to_parents @page %>
   <%= render :partial => "publishing_info", :locals => {:article => @page }%>
 <% end %>


=====================================
public/designs/themes/base/style.scss
=====================================
--- a/public/designs/themes/base/style.scss
+++ b/public/designs/themes/base/style.scss
@@ -1331,6 +1331,11 @@ hr.pre-posts, hr.sep-posts {
       font-weight: 700;
       letter-spacing: -.02rem;
       .author a { font-size: 12px !important; }
+      .bullet-separator,
+      .parent-folder {
+       font-weight: normal;
+      }
+
     }
     .bullet-separator {
       padding: 0 2px;


=====================================
public/stylesheets/cms.scss
=====================================
--- a/public/stylesheets/cms.scss
+++ b/public/stylesheets/cms.scss
@@ -5,6 +5,7 @@
 
 .cms-header {
   display: flex;
+  justify-content: flex-end;
   @media only screen and (max-width: 960px) { display: block; }
   padding: 0px 4px 0px 10px;
   margin-bottom: 1em;


=====================================
public/stylesheets/content.scss
=====================================
--- a/public/stylesheets/content.scss
+++ b/public/stylesheets/content.scss
@@ -167,3 +167,34 @@
     }
   }
 }
+
+#content div.path-to-parents {
+  background: #e8e8e8;
+  padding: 3px 7px;
+  border-bottom-left-radius: 5px;
+  border-bottom-right-radius: 5px;
+  margin-bottom: 5px;
+  a.path-to-parent {
+    margin-right: 5px;
+    text-decoration: none;
+    color: #212e3c;
+    word-spacing: 0.9px;
+
+    &:hover {
+      font-weight: bold;
+      word-spacing: normal;
+    }
+
+    i.fa {
+      margin-right: 7px;
+    }
+  }
+}
+
+#content #article #article-header,
+html.controller-cms #content .main-content {
+  > h1 {
+    margin-bottom: 0;
+  }
+}
+



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/2d76a06cb685f1f4a057172ce85baada532bae1b...f0c286644fc748d5c0f9227b8e795a922a893b5c

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/2d76a06cb685f1f4a057172ce85baada532bae1b...f0c286644fc748d5c0f9227b8e795a922a893b5c
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180608/0baf1412/attachment-0001.html>


More information about the Noosfero-dev mailing list