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
$(document).on 'ready page:load turbolinks:load', ->
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
$linksPanel = $(this)
$linksPanel.animate {left: 0}, 100, ->
$linksPanel.find('.handle i').removeClass('fa-chevron-circle-right').addClass('fa-chevron-circle-left')
window.linksPanelShowed = true
$(document).on 'mouseleave', '#links_panel', ->
$(document).on 'mouseleave', '#container:not(.pinned) #links_panel', ->
$linksPanel = $(this)
$linksPanel.animate {left: 10 - $linksPanel.width()}, 250, ->
$linksPanel.find('.handle i').removeClass('fa-chevron-circle-left').addClass('fa-chevron-circle-right')
window.linksPanelShowed = false
$(document).on 'click', '#links_panel .handle', ->
$(document).on 'click', '#container:not(.pinned) #links_panel .handle', ->
$linksPanel = $('#links_panel')
$linksPanel.animate {left: 10 - $linksPanel.width()}, 250, ->
$linksPanel.find('.handle i').removeClass('fa-chevron-circle-left').addClass('fa-chevron-circle-right')
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
url: window.location.href + "/#{$(ui.item).data('id')}"
data: {position: position}
});
).disableSelection()
)
......@@ -9,6 +9,16 @@ body.admin-body
height: 100%
.yield-column
padding: 0 10px 20px 90px
&.pinned
.yield-column
padding: 0 10px 20px 300px
#links_panel
left: 0
.handle
display: none
.pin
color: #347bb7
footer
position: fixed
bottom: 0
......@@ -17,6 +27,9 @@ body.admin-body
p
margin: 0
.navbar-right
margin-right: 0
#links_panel
position: fixed
width: 300px
......@@ -43,6 +56,16 @@ body.admin-body
&:hover
color: #347bb7
cursor: pointer
.pin
position: absolute
top: 5px
left: 258px
color: darkgrey
font-size: 18px
height: 26px
&:hover
color: #347bb7
cursor: pointer
.page-header
margin: 0 0 5px
......
......@@ -33,7 +33,7 @@ class SettingsController < AdminController
private
# Use callbacks to share common setup or constraints between actions.
def set_setting
@setting = Setting.find(params[:id])
@setting = Setting.find_by(name: params[:id]) || Setting.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
......
......@@ -10,6 +10,7 @@ class Setting < ActiveRecord::Base
title: {default: 'Blank site', format: :string},
description: {default: 'New blank site - it is stub for future site!', format: :string},
keywords: {default: '', format: :string},
links_pinned: {default: false, format: :bool},
favicon: {default: nil, format: :image},
gse_id: {default: '007392588842326689376:3onw-lza4mc', format: :string},
google_analytics_id: {default: 'UA-63039804-12', format: :string}
......@@ -38,6 +39,10 @@ class Setting < ActiveRecord::Base
@@keywords ||= get(:keywords).real_value
end
def self.links_pinned
@@links_pinned ||= get(:links_pinned).real_value
end
def self.favicon
@@favicon ||= get(:favicon).real_value
end
......
......@@ -4,7 +4,7 @@
= model_class.model_name.human(count: 2)
.pull-right
- 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
%table.table.table-striped.filtered_table
%thead
......
......@@ -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")
= t("humanizers.locale.#{I18n.locale}")
%b.caret
%ul.dropdown-menu.pull-right(aria-labelledby="language_selector")
%ul.dropdown-menu(aria-labelledby="language_selector")
-locales.each do |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 }
......
......@@ -28,14 +28,26 @@
%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.navbar-brand >
-#%a.navbar-brand#current_admin_path(href="#{admin_path}") Admin root
%a.hidden-xs.navbar-brand(href="#{admin_path}" data-no-turbolink)= t('activerecord.attributes.page.links.admin_root')
%a.hidden-xs.navbar-brand >
= current_admin_path.html_safe
.navbar-collapse.collapse.navbar-responsive-collapse.navbar-right
.nav.navbar-nav.navbar-right.hidden-xs
%ul.nav.navbar-nav
%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
%button.btn.btn-default.btn-sm.dropdown-toggle(id="sign_in_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
= current_account.email
......@@ -43,10 +55,9 @@
%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.sign_out'), destroy_account_session_path, method: :delete
%li= render 'layouts/language_selector'
=render 'layouts/language_selector'
.container-fluid.yield-container
.container-fluid.yield-container#container{class: (:pinned if Setting.links_pinned)}
.row
.col-xs-0
#links_panel
......@@ -60,6 +71,8 @@
%li= link_to t('helpers.links.front'), root_path, target: :_blank
.handle
%i.fa.fa-chevron-circle-right.fa-2x
.pin
%i.fa.fa-thumb-tack
.col-xs-12.yield-column
= bootstrap_flash
= 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