From aaa5e455fb769dffaafe81e21bbbf1e78bb486b0 Mon Sep 17 00:00:00 2001 From: Saverio Trioni Date: Wed, 3 Jul 2013 02:16:22 +0200 Subject: [PATCH] Added breadcrumbs and offer filters --- app/assets/stylesheets/application.css.scss | 6 ++- app/views/offers/_breadcrumb.html.haml | 25 +++++++++ app/views/offers/edit.html.haml | 1 + app/views/offers/index.html.haml | 60 +++++++++++++-------- app/views/offers/new.html.haml | 1 + app/views/offers/show.html.haml | 2 + app/views/users/_breadcrumb.html.haml | 25 +++++++++ app/views/users/change_password.html.haml | 16 +----- app/views/users/edit.html.haml | 12 +---- app/views/users/index.html.haml | 10 +--- app/views/users/new.html.haml | 13 +---- app/views/users/show.html.haml | 13 +---- 12 files changed, 102 insertions(+), 82 deletions(-) create mode 100644 app/views/offers/_breadcrumb.html.haml create mode 100644 app/views/users/_breadcrumb.html.haml diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 197efe3..3775aca 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -22,6 +22,10 @@ li.offer, li.inquiry { @extend %li.post; } +#side-nav .well { + padding: 15px; +} + @media screen { body { padding-top: 60px; @@ -38,4 +42,4 @@ li.offer, li.inquiry { body { padding-top: 0px; } -} \ No newline at end of file +} diff --git a/app/views/offers/_breadcrumb.html.haml b/app/views/offers/_breadcrumb.html.haml new file mode 100644 index 0000000..0450983 --- /dev/null +++ b/app/views/offers/_breadcrumb.html.haml @@ -0,0 +1,25 @@ +%ul.breadcrumb#breadcrumb + %li + = link_to root_path do + %i.icon-home + %span.divider • + - if @offer + %li + = link_to offers_path do + %i.icon-hand-up + = t "application.nav.offers" + %span.divider • + - if @offer.persisted? + - if defined?(action) + %li + = link_to @offer.title, @offer + %span.divider • + %li.active= t action + - else + %li.active= @offer.title + - else + %li.active= t '.new' + - else + %li.active + %i.icon-hand-up + = t "application.nav.offers" diff --git a/app/views/offers/edit.html.haml b/app/views/offers/edit.html.haml index 86842fe..e01f604 100644 --- a/app/views/offers/edit.html.haml +++ b/app/views/offers/edit.html.haml @@ -1 +1,2 @@ += render 'breadcrumb' = render 'form' \ No newline at end of file diff --git a/app/views/offers/index.html.haml b/app/views/offers/index.html.haml index be3e182..3eebdb4 100644 --- a/app/views/offers/index.html.haml +++ b/app/views/offers/index.html.haml @@ -1,30 +1,46 @@ += render 'breadcrumb' + = link_to("New offer", new_offer_path) +- if @category.present? + = link_to offers_path(params.merge(:cat => nil)), :class => ["label", "label-success"] do + %i.icon-folder-open-alt + = @category.name + × +- if @tag_list.present? -.tag-cloud - %strong - - if params[:tag].present? - = link_to "×", offers_path(params.merge(:tag => nil)) - = succeed ":" do - = t ".by_tag" - = params[:tag] - - else - = t ".by_tag" + - @tag_list.each do |tag| + = link_to offers_path(params.merge(:tag => (@tag_list.dup.remove tag).to_s.presence)), :class => ["label"] do + %i.icon-tag + = tag + × +.accordion + .accordion-group + .accordion-heading + %a.accordion-toggle{href: "#filterPanel", data: {toggle: "collapse"}} + %i.icon-filter + = t ".filter" - - tag_cloud(current_organization.offers.tag_counts_on(:tags), %w(css1 css2 css3 css4)) do |tag, css_class| - = link_to tag.name, offers_path(params.merge(:tag => tag.name)), :class => css_class + .accordion-body.collapse#filterPanel{class: ("in" if @tag_list.present? or @category.present?)} + .accordion-inner + .row-fluid -.categ - %strong - - if params[:cat].present? - = link_to "×", offers_path(params.merge(:cat => nil)) - = succeed ":" do - = t ".by_category" - = Category.find(params[:cat]).name - - else - = t ".by_category" - - Category.all.each do |cat| - = link_to cat.name, offers_path(params.merge(:cat => cat.id)) + .span4 + %h5 + %i.icon-folder-open-alt + = t ".by_category" + - Category.all.each do |cat| + = link_to cat.name, offers_path(params.merge(:cat => (cat.id unless cat == @category))), :class => ["btn", "btn-small", (cat == @category ? "btn-info" : "btn-link")] + + .span4 + %h5 + %i.icon-tag + = t ".by_tag" + - tag_cloud(@tag_cloud, %w(css1 css2 css3 css4)) do |tag, css_class| + - if @tag_list.include? tag.name + = link_to tag.name, offers_path(params.merge(:tag => (@tag_list.dup.remove tag.name).to_s.presence)), :class => ["btn", "btn-small", "btn-inverse"] + - else + = link_to tag.name, offers_path(params.merge(:tag => (@tag_list.dup.add tag.name).to_s)), :class => ["btn", "btn-small", "btn-link"] %ul diff --git a/app/views/offers/new.html.haml b/app/views/offers/new.html.haml index 86842fe..e01f604 100644 --- a/app/views/offers/new.html.haml +++ b/app/views/offers/new.html.haml @@ -1 +1,2 @@ += render 'breadcrumb' = render 'form' \ No newline at end of file diff --git a/app/views/offers/show.html.haml b/app/views/offers/show.html.haml index d1ef2cd..de5e006 100644 --- a/app/views/offers/show.html.haml +++ b/app/views/offers/show.html.haml @@ -1,3 +1,5 @@ += render 'breadcrumb' + %h1 = @offer.title %small= @offer.category diff --git a/app/views/users/_breadcrumb.html.haml b/app/views/users/_breadcrumb.html.haml new file mode 100644 index 0000000..e254fc2 --- /dev/null +++ b/app/views/users/_breadcrumb.html.haml @@ -0,0 +1,25 @@ +%ul.breadcrumb#breadcrumb + %li + = link_to root_path do + %i.icon-home + %span.divider • + - if @user + %li + = link_to users_path do + %i.icon-user + = t "application.nav.users" + %span.divider • + - if @user.persisted? + - if defined?(action) + %li + = link_to @user.username, @user + %span.divider • + %li.active= t action + - else + %li.active= @user.username + - else + %li.active= t '.new' + - else + %li.active + %i.icon-user + = t "application.nav.users" diff --git a/app/views/users/change_password.html.haml b/app/views/users/change_password.html.haml index b9270a8..2ee97e7 100644 --- a/app/views/users/change_password.html.haml +++ b/app/views/users/change_password.html.haml @@ -1,18 +1,4 @@ -%ul.breadcrumb#breadcrumb - %li - = link_to root_path do - %i.icon-home - %span.divider • - %li - = link_to users_path do - %i.icon-user - = t "application.nav.users" - %span.divider • - %li - = link_to user_path(@user) do - = @user.username - %span.divider • - %li.active= t "change_password" += render "breadcrumb", action: "change_password" %h1 %i.icon-key.icon-border diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml index 0fd59c1..66e334b 100644 --- a/app/views/users/edit.html.haml +++ b/app/views/users/edit.html.haml @@ -1,14 +1,4 @@ -%ul.breadcrumb#breadcrumb - %li - = link_to root_path do - %i.icon-home - %span.divider • - %li - = link_to users_path do - %i.icon-user - = t "application.nav.users" - %span.divider • - %li.active= @user.username += render "breadcrumb" %h1 %i.icon-edit.icon-fixed-width diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index 0341c11..51d1b1b 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -1,12 +1,4 @@ -%ul.breadcrumb#breadcrumb - %li - = link_to root_path do - %i.icon-home - %span.divider • - %li.active - = link_to_unless_current users_path do - %i.icon-tags - = t "application.nav.users" += render "breadcrumb" %h1 %i.icon-user.icon-border diff --git a/app/views/users/new.html.haml b/app/views/users/new.html.haml index 92c4ea8..ad2322f 100644 --- a/app/views/users/new.html.haml +++ b/app/views/users/new.html.haml @@ -1,15 +1,4 @@ -%ul.breadcrumb#breadcrumb - %li - = link_to root_path do - %i.icon-home - %span.divider • - %li - = link_to users_path do - %i.icon-user - = t "application.nav.users" - %span.divider • - %li.active= t "New user" - += render "breadcrumb" %h1 %i.icon-user.icon-border diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 0d39678..3a88889 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -1,15 +1,4 @@ -%ul.breadcrumb#breadcrumb - %li - = link_to root_path do - %i.icon-home - %span.divider • - %li - = link_to users_path do - %i.icon-user - = t "application.nav.users" - %span.divider • - %li.active= @user.username - += render "breadcrumb" %h1 %i.icon-user.icon-border