Skip to content

Commit

Permalink
Fix CMS bug on libraries index page
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Altmann committed Dec 13, 2014
1 parent 7f62ebe commit 2eed7fb
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions app/views/libraries/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -20,51 +20,61 @@
/ along with Fairmondo. If not, see <http://www.gnu.org/licenses/>.
/
/ Title
h1.Title-next-to-tab
=> t('libraries.title')
span.sprite_helper title="#{ t('libraries.tooltip') }"

/ Tabs
- if !user_focused? || @user == current_user
ul.Tabs
= render 'mode_menu_item', text: t('libraries.tabs.updated'), path: new_libraries_path, selected: (@mode == 'new'), icon: 'refresh'
= render 'mode_menu_item', text: t('libraries.tabs.trending'), path: trending_libraries_path, selected: (@mode == 'trending'), icon: 'line-chart'
= render 'mode_menu_item', text: t('libraries.tabs.favorites'), path: myfavorite_libraries_path, selected: (@mode == 'myfavorite'), icon: 'heart'
= render 'mode_menu_item',
text: t('libraries.tabs.updated'), path: new_libraries_path,
selected: (@mode == 'new'), icon: 'refresh'
= render 'mode_menu_item',
text: t('libraries.tabs.trending'), path: trending_libraries_path,
selected: (@mode == 'trending'), icon: 'line-chart'
= render 'mode_menu_item',
text: t('libraries.tabs.favorites'), path: myfavorite_libraries_path,
selected: (@mode == 'myfavorite'), icon: 'heart'
- if user_signed_in?
= render 'mode_menu_item', text: t('libraries.tabs.own'), path: user_libraries_path(current_user), selected: user_focused?, icon: 'user'
= render 'mode_menu_item',
text: t('libraries.tabs.own'), path: user_libraries_path(current_user),
selected: user_focused?, icon: 'user'

.libraries
/ Show convenient link to new library form if it's available and there are more than 5 libraries
/ Link to new library form
- if @library && policy(@library).create? && @libraries.length > 5
p#library-form-link= link_to t('libraries.create_new'), '#library-form'

/ When the user is not signed in and myfavorite is selected, render a message
/ Sign-in message
- if !user_signed_in? && @mode == 'myfavorite'
p
= link_to(t('libraries.sign_in'), new_session_path(:user)) + ', '
= t('libraries.to_show_favorites') + ' '
= link_to(t('libraries.sign_up'), new_registration_path(:user)) + '.'

/ Show christmas gift text
/ Christmas gift text
- if !user_focused?
p
= tinycms_content("gift_message")
/ = "In allen Sammlungen mit #Geschenke im Titel findest Du Empfehlungen von anderen Nutzer*innen für schöne Weihnachtsgeschenke. Du kannst auch selbst Geschenk-Sammlungen anlegen - lies hier, wie das geht"
p= tinycms_content_body('gift_message')

/ Show libraries
/ Libraries
- if user_signed_in? || @mode != 'myfavorite'
- if @libraries.any?
= render partial: "libraries/library", collection: @libraries
= paginate @libraries
- else
p= t('libraries.no_library')

/ Form to create a new library at the bottom of the page
/ New library form
- if @library && policy(@library).create?
#library-form
h3= t('library.new')
= semantic_form_for(@library, url: user_libraries_path(current_user), namespace: 'new') do |f|
= semantic_form_for(@library, url: user_libraries_path(current_user),
namespace: 'new') do |f|
= f.inputs do
= f.input :name, required: false, input_html: { autocomplete: 'off' }
= f.input :public, label: false
= f.actions do
= f.action :submit , value: t('library.create'), button_html: { class: 'Button' }
= f.action :submit , value: t('library.create'),
button_html: { class: 'Button' }

0 comments on commit 2eed7fb

Please sign in to comment.