tusur_header 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70dda324600234e9b5391acfee08196b3aa0e8de
4
- data.tar.gz: e6eaa582d95b66b284d0c58a61e5a31763accca4
3
+ metadata.gz: f5f3d7b10f27c5e35474b6368794bb5d2512dfdf
4
+ data.tar.gz: 3916c05d75e9c3f345707cc86acb26835a5b2c99
5
5
  SHA512:
6
- metadata.gz: ef06c2e755f214146438368dc64bd9e20adae9fc285ffae45c069aa0a2ebd57bab4d3337479d0a18571cb95526a948ee5fc16d5cdf72c8af21852a593fba3a9e
7
- data.tar.gz: f13440c08cfd6e4fd5e3bccfab6581a2730106f1ff80a175d99468068cc53e4f0c291e6fd027dcfe2e558fd2093f7130d12e169c4bdeb8754b6623418b1b9ce5
6
+ metadata.gz: f8fc63c260e24349e68b401f1ca6046819d4ac9ae20a37a3eb99fd7407148ad32d89249f48118dfbbeb25750763457d46332ed925a3bb4fb7a87c39c6c706c5b
7
+ data.tar.gz: b736acd845454e3524fd3a7cc1b831ceb6cad1f6e8627b058073621e2a0142e5c88b421b621768e7bc1708e9882621508e75c320c0f4e1ac4027f0624cee0973
@@ -16,10 +16,21 @@
16
16
  </div>
17
17
  <% end %>
18
18
 
19
- <div class='tusur_header_wrapper'>
20
- <% begin %>
21
- <%= render_cdn :header %>
22
- <% rescue %>
19
+ <% begin %>
20
+ <% raise 'redis.cdn not found' if Settings['redis.cdn'].blank? %>
21
+ <%= render_cdn('header').gsub('&quot;', '"').gsub('&gt;', '>').html_safe %>
22
+ <% if content_for?(:tusur_cdn_header_subtop) %>
23
+ <div class='tusur-cdn-header-subtop'>
24
+ <%= yield :tusur_cdn_header_subtop %>
25
+ </div>
26
+ <% end %>
27
+ <% if content_for?(:tusur_cdn_header_menu) %>
28
+ <div class='tusur-cdn-header-menu'>
29
+ <%= yield :tusur_cdn_header_menu %>
30
+ </div>
31
+ <% end %>
32
+ <% rescue %>
33
+ <div class='tusur_header_wrapper'>
23
34
  <div class='navbar navbar-inverse navbar-fixed-top navbar-desktop' role='navigation' id='menu_first'>
24
35
  <div class='container'>
25
36
 
@@ -59,43 +70,44 @@
59
70
  </div>
60
71
  </div>
61
72
  </div>
62
- <% end %>
63
- <div class='navbar navbar-inverse navbar-second-menu' role='navigation' id='menu_second'>
64
- <div class='container'>
65
73
 
66
- <!-- Левая часть второй линии меню -->
67
- <% if content_for?(:tusur_header_second_menu_left) %>
68
- <%= yield :tusur_header_second_menu_left %>
69
- <% end %>
70
- <!-- / Левая часть второй линии меню -->
74
+ <div class='navbar navbar-inverse navbar-second-menu' role='navigation' id='menu_second'>
75
+ <div class='container'>
71
76
 
72
- <!-- Правая часть второй линии меню -->
73
- <% if content_for?(:tusur_header_second_menu_right) %>
74
- <%= yield :tusur_header_second_menu_right %>
75
- <% end %>
76
- <!-- / Правая часть второй линии меню -->
77
+ <!-- Левая часть второй линии меню -->
78
+ <% if content_for?(:tusur_header_second_menu_left) %>
79
+ <%= yield :tusur_header_second_menu_left %>
80
+ <% end %>
81
+ <!-- / Левая часть второй линии меню -->
82
+
83
+ <!-- Правая часть второй линии меню -->
84
+ <% if content_for?(:tusur_header_second_menu_right) %>
85
+ <%= yield :tusur_header_second_menu_right %>
86
+ <% end %>
87
+ <!-- / Правая часть второй линии меню -->
77
88
 
89
+ </div>
78
90
  </div>
79
- </div>
80
91
 
81
- <div class='navbar navbar-inverse navbar-fixed-top navbar-mobile' role='navigation' id='menu_mobile'>
82
- <div class='container'>
92
+ <div class='navbar navbar-inverse navbar-fixed-top navbar-mobile' role='navigation' id='menu_mobile'>
93
+ <div class='container'>
83
94
 
84
- <div class='navbar-header'>
85
- <button type='button' class='navbar-toggle mobile-toggler' data-toggle='collapse' data-target='#site-menu'>
86
- <span class='icon-bar'></span>
87
- <span class='icon-bar'></span>
88
- <span class='icon-bar'></span>
89
- </button>
90
- <a class='navbar-brand' href='/'></a>
91
- </div>
95
+ <div class='navbar-header'>
96
+ <button type='button' class='navbar-toggle mobile-toggler' data-toggle='collapse' data-target='#site-menu'>
97
+ <span class='icon-bar'></span>
98
+ <span class='icon-bar'></span>
99
+ <span class='icon-bar'></span>
100
+ </button>
101
+ <a class='navbar-brand' href='/'></a>
102
+ </div>
92
103
 
93
- <div class='navbar-collapse collapse' id='site-menu'>
94
- <% if content_for?(:tusur_header_mobile_menu_block) %>
95
- <%= yield :tusur_header_mobile_menu_block %>
96
- <% end %>
97
- </div>
104
+ <div class='navbar-collapse collapse' id='site-menu'>
105
+ <% if content_for?(:tusur_header_mobile_menu_block) %>
106
+ <%= yield :tusur_header_mobile_menu_block %>
107
+ <% end %>
108
+ </div>
98
109
 
110
+ </div>
99
111
  </div>
100
112
  </div>
101
- </div>
113
+ <% end %>
@@ -21,7 +21,7 @@ module TusurHeader
21
21
  end
22
22
 
23
23
  def separator
24
- content_tag :li, nil, :class => 'divider'
24
+ content_tag :li, nil, class: 'divider'
25
25
  end
26
26
  end
27
27
 
@@ -29,7 +29,7 @@ module TusurHeader
29
29
  include ActionView::Helpers
30
30
 
31
31
  attr_accessor :user
32
- delegate :uid, :teacher?, :student?, :app_name, :to => :user
32
+ delegate :uid, :teacher?, :student?, :app_name, to: :user
33
33
 
34
34
  def initialize(user)
35
35
  @user = user
@@ -42,7 +42,7 @@ module TusurHeader
42
42
  end
43
43
 
44
44
  def list
45
- content_tag :ul, links.join.html_safe, :class => 'dropdown-menu'
45
+ content_tag :ul, links.join.html_safe, class: 'dropdown-menu'
46
46
  end
47
47
 
48
48
  def system_infos
@@ -66,38 +66,7 @@ module TusurHeader
66
66
  end
67
67
 
68
68
  def sign_out_url
69
- path = "/users/sign_out?redirect_url=#{Settings['app.url']}"
70
-
71
- sign_out_link + path
72
- end
73
-
74
- # TODO: remove
75
- def example_system_infos
76
- {
77
- :timetable_info => {
78
- :url => {
79
- :title => 'TITLE #1',
80
- :link => 'http://url1.com'
81
- },
82
-
83
- :my_url => {
84
- :title => 'MY TITLE #1',
85
- :link => 'http://my_url1.com'
86
- }
87
- }.to_json,
88
-
89
- :attendance_info => {
90
- :url => {
91
- :title => 'TITLE #2',
92
- :link => 'http://url2.com'
93
- },
94
-
95
- :my_url => {
96
- :title => 'MY TITLE #2',
97
- :link => 'http://my_url2.com'
98
- }
99
- }.to_json
100
- }
69
+ "#{sign_out_link}/users/sign_out?redirect_url=#{Settings['app.url']}"
101
70
  end
102
71
 
103
72
  def links_from_system_infos(key)
@@ -108,29 +77,34 @@ module TusurHeader
108
77
 
109
78
  def links_data
110
79
  @links_hash ||= begin
111
- array = []
112
80
 
81
+ my_urls = []
113
82
  if links_from_system_infos('my_url').any?
114
- links_from_system_infos('my_url').each do |elem|
115
- array << { :title => elem['title'], :url => elem['link'] }
83
+ links_from_system_infos('my_url').reject{ |elem| elem['link'].blank? }.each do |elem|
84
+ my_urls << { title: elem['title'], url: elem['link'] }
116
85
  end
117
86
 
118
- array << { :separator => true }
87
+ my_urls = my_urls.sort{ |a, b| a[:title] <=> b[:title] }
88
+ my_urls << { separator: true }
119
89
  end
120
90
 
121
- array << { :title => 'Кабинет ТУСУР', :url => profile_url+'/' }
122
-
91
+ urls = []
92
+ urls << { title: 'Кабинет ТУСУР', url: "#{profile_url}/" }
123
93
  if links_from_system_infos('url').any?
124
- links_from_system_infos('url').each do |elem|
125
- array << { :title => elem['title'], :url => elem['link'] }
94
+ links_from_system_infos('url').reject{ |elem| elem['link'].blank? }.each do |elem|
95
+ urls << { title: elem['title'], url: elem['link'] }
126
96
  end
127
- array << { :separator => true }
128
97
  end
129
98
 
130
- array << { :title => 'Редактировать профиль', :url => edit_user_url }
131
- array << { :title => 'Выход', :url => sign_out_url, :options => { :method => :delete } }
99
+ urls = urls.sort{ |a, b| a[:title] <=> b[:title] }
100
+ urls << { separator: true }
101
+
102
+ array = my_urls + urls
103
+ array << { title: 'Редактировать профиль', url: edit_user_url }
104
+ array << { title: 'Выход', url: sign_out_url, options: { method: :delete } }
132
105
 
133
106
  array
107
+
134
108
  end
135
109
  end
136
110
  end
@@ -1,3 +1,3 @@
1
1
  module TusurHeader
2
- VERSION = '0.2.7'
2
+ VERSION = '0.2.8'
3
3
  end
@@ -127,6 +127,7 @@
127
127
  +border-radius(0)
128
128
  background: #005bae
129
129
  border: none
130
+ margin: 40px 0 0 0
130
131
  min-height: 40px
131
132
 
132
133
  .search
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tusur_header
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeny Lapin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-07 00:00:00.000000000 Z
11
+ date: 2016-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler