Commit 3cd81164 authored by cp's avatar cp

pinned links

git-svn-id: http://svn.sp-service.com.ua/svnroot/svn/base_site/trunk@7 d975c5f9-4e99-4c31-b122-d878075b96d9
parent ebf1e35e
window.linksPanelShowed = false window.linksPanelShowed = false
$(document).on 'ready page:load turbolinks:load', -> $(document).on 'ready page:load turbolinks:load', ->
if window.linksPanelShowed if window.linksPanelShowed
$('#links_panel').css left: 0 $('#container:not(.pinned) #links_panel').css left: 0
$(document).on 'mouseover click', '#links_panel', -> $(document).on 'mouseover click', '#container:not(.pinned) #links_panel', ->
unless window.linksPanelShowed unless window.linksPanelShowed
$linksPanel = $(this) $linksPanel = $(this)
$linksPanel.animate {left: 0}, 100, -> $linksPanel.animate {left: 0}, 100, ->
$linksPanel.find('.handle i').removeClass('fa-chevron-circle-right').addClass('fa-chevron-circle-left') $linksPanel.find('.handle i').removeClass('fa-chevron-circle-right').addClass('fa-chevron-circle-left')
window.linksPanelShowed = true window.linksPanelShowed = true
$(document).on 'mouseleave', '#links_panel', -> $(document).on 'mouseleave', '#container:not(.pinned) #links_panel', ->
$linksPanel = $(this) $linksPanel = $(this)
$linksPanel.animate {left: 10 - $linksPanel.width()}, 250, -> $linksPanel.animate {left: 10 - $linksPanel.width()}, 250, ->
$linksPanel.find('.handle i').removeClass('fa-chevron-circle-left').addClass('fa-chevron-circle-right') $linksPanel.find('.handle i').removeClass('fa-chevron-circle-left').addClass('fa-chevron-circle-right')
window.linksPanelShowed = false window.linksPanelShowed = false
$(document).on 'click', '#links_panel .handle', -> $(document).on 'click', '#container:not(.pinned) #links_panel .handle', ->
$linksPanel = $('#links_panel') $linksPanel = $('#links_panel')
$linksPanel.animate {left: 10 - $linksPanel.width()}, 250, -> $linksPanel.animate {left: 10 - $linksPanel.width()}, 250, ->
$linksPanel.find('.handle i').removeClass('fa-chevron-circle-left').addClass('fa-chevron-circle-right') $linksPanel.find('.handle i').removeClass('fa-chevron-circle-left').addClass('fa-chevron-circle-right')
window.linksPanelShowed = false window.linksPanelShowed = false
$(document).on 'click', '#container:not(.pinned) #links_panel .pin', ->
$('#container').addClass('pinned')
$.ajax '/admin/settings/links_pinned', method: 'patch', dataType: 'json', data: {setting: {value: 1}}
$(document).on 'click', '#container.pinned #links_panel .pin', ->
$('#container').removeClass('pinned')
$.ajax '/admin/settings/links_pinned', method: 'patch', dataType: 'json', data: {setting: {value: 0}}
...@@ -14,4 +14,4 @@ init_sortable = (container_selector, item_selector, axis = 'y', handle_selector ...@@ -14,4 +14,4 @@ init_sortable = (container_selector, item_selector, axis = 'y', handle_selector
url: window.location.href + "/#{$(ui.item).data('id')}" url: window.location.href + "/#{$(ui.item).data('id')}"
data: {position: position} data: {position: position}
}); });
).disableSelection() )
...@@ -9,6 +9,16 @@ body.admin-body ...@@ -9,6 +9,16 @@ body.admin-body
height: 100% height: 100%
.yield-column .yield-column
padding: 0 10px 20px 90px padding: 0 10px 20px 90px
&.pinned
.yield-column
padding: 0 10px 20px 300px
#links_panel
left: 0
.handle
display: none
.pin
color: #347bb7
footer footer
position: fixed position: fixed
bottom: 0 bottom: 0
...@@ -17,6 +27,9 @@ body.admin-body ...@@ -17,6 +27,9 @@ body.admin-body
p p
margin: 0 margin: 0
.navbar-right
margin-right: 0
#links_panel #links_panel
position: fixed position: fixed
width: 300px width: 300px
...@@ -43,6 +56,16 @@ body.admin-body ...@@ -43,6 +56,16 @@ body.admin-body
&:hover &:hover
color: #347bb7 color: #347bb7
cursor: pointer cursor: pointer
.pin
position: absolute
top: 5px
left: 258px
color: darkgrey
font-size: 18px
height: 26px
&:hover
color: #347bb7
cursor: pointer
.page-header .page-header
margin: 0 0 5px margin: 0 0 5px
......
...@@ -33,7 +33,7 @@ class SettingsController < AdminController ...@@ -33,7 +33,7 @@ class SettingsController < AdminController
private private
# Use callbacks to share common setup or constraints between actions. # Use callbacks to share common setup or constraints between actions.
def set_setting def set_setting
@setting = Setting.find(params[:id]) @setting = Setting.find_by(name: params[:id]) || Setting.find(params[:id])
end end
# Never trust parameters from the scary internet, only allow the white list through. # Never trust parameters from the scary internet, only allow the white list through.
......
...@@ -10,6 +10,7 @@ class Setting < ActiveRecord::Base ...@@ -10,6 +10,7 @@ class Setting < ActiveRecord::Base
title: {default: 'Blank site', format: :string}, title: {default: 'Blank site', format: :string},
description: {default: 'New blank site - it is stub for future site!', format: :string}, description: {default: 'New blank site - it is stub for future site!', format: :string},
keywords: {default: '', format: :string}, keywords: {default: '', format: :string},
links_pinned: {default: false, format: :bool},
favicon: {default: nil, format: :image}, favicon: {default: nil, format: :image},
gse_id: {default: '007392588842326689376:3onw-lza4mc', format: :string}, gse_id: {default: '007392588842326689376:3onw-lza4mc', format: :string},
google_analytics_id: {default: 'UA-63039804-12', format: :string} google_analytics_id: {default: 'UA-63039804-12', format: :string}
...@@ -38,6 +39,10 @@ class Setting < ActiveRecord::Base ...@@ -38,6 +39,10 @@ class Setting < ActiveRecord::Base
@@keywords ||= get(:keywords).real_value @@keywords ||= get(:keywords).real_value
end end
def self.links_pinned
@@links_pinned ||= get(:links_pinned).real_value
end
def self.favicon def self.favicon
@@favicon ||= get(:favicon).real_value @@favicon ||= get(:favicon).real_value
end end
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
= model_class.model_name.human(count: 2) = model_class.model_name.human(count: 2)
.pull-right .pull-right
- newsletter_params = tabular_filter.condition.present? ? {newsletter: {recipient_filter: tabular_filter.condition}} : nil - newsletter_params = tabular_filter.condition.present? ? {newsletter: {recipient_filter: tabular_filter.condition}} : nil
= link_to 'Newsletter', new_newsletter_path(newsletter_params), class: 'btn btn-default' = link_to 'Newsletter', new_newsletter_path(newsletter_params), class: 'btn btn-default btn-sm'
= will_paginate @accounts = will_paginate @accounts
%table.table.table-striped.filtered_table %table.table.table-striped.filtered_table
%thead %thead
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
%button.btn.btn-default.btn-sm.style_lang.dropdown-toggle(id="language_selector" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false") %button.btn.btn-default.btn-sm.style_lang.dropdown-toggle(id="language_selector" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
= t("humanizers.locale.#{I18n.locale}") = t("humanizers.locale.#{I18n.locale}")
%b.caret %b.caret
%ul.dropdown-menu.pull-right(aria-labelledby="language_selector") %ul.dropdown-menu(aria-labelledby="language_selector")
-locales.each do |locale| -locales.each do |locale|
%li{class: ('active' if I18n.locale == locale.to_sym)}= link_to t("humanizers.locale.#{locale}"), %li{class: ('active' if I18n.locale == locale.to_sym)}= link_to t("humanizers.locale.#{locale}"),
current_url_for_locale(locale), data: { no_turbolink: true } current_url_for_locale(locale), data: { no_turbolink: true }
......
...@@ -28,14 +28,26 @@ ...@@ -28,14 +28,26 @@
%span.icon-bar %span.icon-bar
%span.icon-bar %span.icon-bar
%span.icon-bar %span.icon-bar
%a.navbar-brand(href="#{admin_path}" data-no-turbolink)= t('activerecord.attributes.page.links.admin_root') %a.hidden-xs.navbar-brand(href="#{admin_path}" data-no-turbolink)= t('activerecord.attributes.page.links.admin_root')
%a.navbar-brand > %a.hidden-xs.navbar-brand >
-#%a.navbar-brand#current_admin_path(href="#{admin_path}") Admin root
= current_admin_path.html_safe = current_admin_path.html_safe
.navbar-collapse.collapse.navbar-responsive-collapse.navbar-right .nav.navbar-nav.navbar-right.hidden-xs
%ul.nav.navbar-nav %ul.nav.navbar-nav
%li.navbar-text= t('helpers.titles.logged_in_as') %li.navbar-text= t('helpers.titles.logged_in_as')
%li.navbar-btn.dropdown
%button.btn.btn-default.btn-sm.dropdown-toggle(id="sign_in_mob_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
= current_account.email
%b.caret
%ul.dropdown-menu.dropdown-menu-right(aria-labelledby="sign_in_mob_menu")
%li= link_to t('helpers.links.change_password'), edit_account_registration_path, data: { no_turbolink: true }
%li= link_to t('helpers.links.sign_out'), destroy_account_session_path, method: :delete
=render 'layouts/language_selector'
.nav.navbar-collapse.collapse.navbar-responsive-collapse
.container-fluid.visible-xs
%ul.nav.navbar-nav
%li= t('helpers.titles.logged_in_as')
%li.navbar-btn.dropdown %li.navbar-btn.dropdown
%button.btn.btn-default.btn-sm.dropdown-toggle(id="sign_in_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false") %button.btn.btn-default.btn-sm.dropdown-toggle(id="sign_in_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
= current_account.email = current_account.email
...@@ -43,10 +55,9 @@ ...@@ -43,10 +55,9 @@
%ul.dropdown-menu.dropdown-menu-right(aria-labelledby="sign_in_menu") %ul.dropdown-menu.dropdown-menu-right(aria-labelledby="sign_in_menu")
%li= link_to t('helpers.links.change_password'), edit_account_registration_path, data: { no_turbolink: true } %li= link_to t('helpers.links.change_password'), edit_account_registration_path, data: { no_turbolink: true }
%li= link_to t('helpers.links.sign_out'), destroy_account_session_path, method: :delete %li= link_to t('helpers.links.sign_out'), destroy_account_session_path, method: :delete
%li= render 'layouts/language_selector'
=render 'layouts/language_selector' .container-fluid.yield-container#container{class: (:pinned if Setting.links_pinned)}
.container-fluid.yield-container
.row .row
.col-xs-0 .col-xs-0
#links_panel #links_panel
...@@ -60,6 +71,8 @@ ...@@ -60,6 +71,8 @@
%li= link_to t('helpers.links.front'), root_path, target: :_blank %li= link_to t('helpers.links.front'), root_path, target: :_blank
.handle .handle
%i.fa.fa-chevron-circle-right.fa-2x %i.fa.fa-chevron-circle-right.fa-2x
.pin
%i.fa.fa-thumb-tack
.col-xs-12.yield-column .col-xs-12.yield-column
= bootstrap_flash = bootstrap_flash
= yield = yield
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment