flash and notification messages growl style

James Peret 10 gadi atpakaļ
vecāks
revīzija
53a5e004d6

+ 14 - 0
app/assets/javascripts/bootstrap.js.coffee

@@ -1,3 +1,17 @@
1 1
 jQuery ->
2 2
   $("a[rel~=popover], .has-popover").popover()
3 3
   $("a[rel~=tooltip], .has-tooltip").tooltip()
4
+
5
+$ ->
6
+  flashCallback = ->
7
+    $(".flash-message").fadeOut()
8
+  $(".flash-message").bind 'click', (ev) =>
9
+    $(".flash-message").fadeOut()
10
+  setTimeout flashCallback, 4000
11
+
12
+$ ->
13
+  alertCallback = ->
14
+    $(".alert").fadeOut()
15
+  $(".alert").bind 'click', (ev) =>
16
+    $(".alert").fadeOut()
17
+  setTimeout alertCallback, 4000

+ 1 - 1
app/assets/stylesheets/avl2_theme/cover.less

@@ -57,7 +57,7 @@ bottom: 0;
57 57
 .mastfoot .inner { padding: 0px; }
58 58
 
59 59
 .cover-center {
60
-	width: 350px;
60
+	width: 370px;
61 61
 	margin-left: auto;
62 62
 	margin-right: auto;
63 63
 	margin-top: 90px;

+ 55 - 0
app/assets/stylesheets/avl2_theme/flash_messages.less

@@ -0,0 +1,55 @@
1
+// Flash Messages
2
+
3
+@import "colors.less";
4
+
5
+.flash-message, .alert {
6
+	color: black;
7
+	z-index: 999;
8
+	top: 60px;
9
+	position: fixed;
10
+	font-weight: bold;
11
+	margin: 20px;
12
+	cursor: pointer;
13
+	.msg-container {
14
+		width: 350px;
15
+		float: right;
16
+	     box-shadow: 2px 2px 7px #888888;
17
+	     padding: 15px;
18
+		border-radius: @theme-border-radius;
19
+		font-size: 110%;
20
+	}
21
+	p {
22
+	  margin: 0px;
23
+	}
24
+
25
+}
26
+
27
+.flash-message { width: 96%; }
28
+
29
+.alert { 
30
+	width: 350px;
31
+	right: 20px; 
32
+	border-radius: @theme-border-radius;
33
+	padding: 15px;
34
+	font-size: 110%;
35
+}
36
+
37
+.flash-message.error .msg-container, .alert.alert-danger, .alert.alert-error {
38
+	border: @theme-border;
39
+	background-color: lighten(@red, 25%);
40
+	border-color: @red;
41
+}
42
+
43
+.flash-message.notice .msg-container, .alert.alert-success {
44
+	border: @theme-border;
45
+	background-color: lighten(@green, 25%);
46
+	border-color: @green;
47
+}
48
+
49
+.alert .close {
50
+	display: none;
51
+	position: relative;
52
+	top: -2px;
53
+	right: 0px;
54
+	line-height: 20px;
55
+}

+ 5 - 1
app/assets/stylesheets/avl2_theme/forms.less

@@ -16,7 +16,7 @@ div.form-group {
16 16
 	
17 17
 }
18 18
 
19
-input.form-control.input-block-level { min-height: 42px;}
19
+input.form-control.input-block-level { min-height: 42px; margin-bottom: 0px;}
20 20
 
21 21
 select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input {
22 22
 	display: inline-block;
@@ -41,4 +41,8 @@ select, textarea, input[type="text"], input[type="password"], input[type="dateti
41 41
 		float: left;
42 42
 	}
43 43
 	.selectpicker { margin-top: 6px; }
44
+}
45
+
46
+.cover-container .help-block {
47
+	color: white;
44 48
 }

+ 2 - 1
app/assets/stylesheets/bootstrap_and_overrides.css.less

@@ -83,4 +83,5 @@
83 83
 
84 84
 .form-bordered {
85 85
 	margin-bottom: 0px;
86
-}
86
+}
87
+

+ 1 - 1
app/views/devise/registrations/edit.html.erb

@@ -3,7 +3,7 @@
3 3
 <%= content_tag(:div, class: 'container top-container') do %>
4 4
 	<%= content_tag(:div, class: 'row') do %>
5 5
 		<%= content_tag(:div, class: 'span12') do %>
6
-			<%= bootstrap_flash %>
6
+			<%= render :partial => 'layouts/flash' %>
7 7
 			
8 8
 			<% # Page Content %>
9 9
 

+ 1 - 1
app/views/devise/registrations/new.html.erb

@@ -3,7 +3,7 @@
3 3
 <%= content_tag(:div, class: 'cover-center compact-form') do%>
4 4
 	<%= image_tag('avalanche_network_logo_full_small.png', size: '208x150', class: 'centered')%>
5 5
 	<%= bootstrap_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
6
-	    <%= bootstrap_flash %>
6
+	    <%= render :partial => 'layouts/flash' %>
7 7
 	    <%= f.alert_message "Please fix the errors below."%>
8 8
 	    <%= content_tag(:fieldset) do %>
9 9
 		    <%= f.text_field :first_name, hide_label: true, placeholder: (t 'registration.first_name'), required:true, autofocus: true, class: 'input-block-level' %>

+ 11 - 0
app/views/layouts/_flash.html.erb

@@ -0,0 +1,11 @@
1
+<% if notice || alert %>
2
+  <div class="flash-message <%= notice ? "notice" : ""%><%= alert ? "error" : ""%>">
3
+      <div class="msg-container">
4
+        <% if notice %>
5
+          <p><%= notice %></p>
6
+        <% elsif alert %>
7
+          <p><%= alert %></p>
8
+        <% end %>
9
+      </div>
10
+    </div>
11
+<% end %>

+ 2 - 0
app/views/mission_editor/agents/edit.html.erb

@@ -2,6 +2,8 @@
2 2
 
3 3
 <%= render :partial => 'missions/mission_editor_tabs' %>
4 4
 
5
+<%= render :partial => 'layouts/flash' %>
6
+
5 7
 <%= content_tag(:div, class: 'container-bg') do %>
6 8
 	<%= content_tag(:div, class: 'container container-bg mission-detail-container') do %>
7 9
 		<%= content_tag(:div, class: 'row') do %>

+ 2 - 0
app/views/mission_editor/agents/index.html.erb

@@ -1,5 +1,7 @@
1 1
 <%= render :partial => 'missions/mission_editor_tabs' %>
2 2
 
3
+<%= render :partial => 'layouts/flash' %>
4
+
3 5
 <%= content_tag(:div, class: 'container-bg') do %>
4 6
 	<%= content_tag(:div, class: 'container container-bg mission-detail-container') do %>
5 7
 		<%= content_tag(:div, class: 'row') do %>

+ 2 - 0
app/views/mission_editor/agents/new.html.erb

@@ -2,6 +2,8 @@
2 2
 
3 3
 <%= render :partial => 'missions/mission_editor_tabs' %>
4 4
 
5
+<%= render :partial => 'layouts/flash' %>
6
+
5 7
 <%= content_tag(:div, class: 'container-bg') do %>
6 8
 	<%= content_tag(:div, class: 'container container-bg mission-detail-container') do %>
7 9
 		<%= content_tag(:div, class: 'row') do %>

+ 1 - 2
app/views/mission_editor/details/launch.html.erb

@@ -1,6 +1,5 @@
1 1
 <%= render :partial => 'missions/mission_editor_tabs' %>
2
-
3
-
2
+<%= render :partial => 'layouts/flash' %>
4 3
 
5 4
 <%= content_tag(:div, class: 'container-bg') do %>
6 5
 	<%= content_tag(:div, class: 'container container-bg mission-detail-container') do %>

+ 1 - 2
app/views/mission_editor/rewards/edit.html.erb

@@ -1,8 +1,7 @@
1
-
2
-
3 1
 <% title "#{t 'mission_editor.rewards.edit'} - #{@config.website_name}" %>
4 2
 
5 3
 <%= render :partial => 'missions/mission_editor_tabs' %>
4
+<%= render :partial => 'layouts/flash' %>
6 5
 
7 6
 <%= content_tag(:div, class: 'container-bg') do %>
8 7
 	<%= content_tag(:div, class: 'container container-bg mission-detail-container') do %>

+ 1 - 0
app/views/mission_editor/rewards/index.html.erb

@@ -1,4 +1,5 @@
1 1
 <%= render :partial => 'missions/mission_editor_tabs' %>
2
+<%= render :partial => 'layouts/flash' %>
2 3
 
3 4
 <%= content_tag(:div, class: 'container-bg') do %>
4 5
 	<%= content_tag(:div, class: 'container container-bg mission-detail-container') do %>

+ 1 - 0
app/views/mission_editor/rewards/new.html.erb

@@ -1,6 +1,7 @@
1 1
 <% title "#{t 'mission_editor.rewards.add'} - #{@config.website_name}" %>
2 2
 
3 3
 <%= render :partial => 'missions/mission_editor_tabs' %>
4
+<%= render :partial => 'layouts/flash' %>
4 5
 
5 6
 <%= content_tag(:div, class: 'container-bg') do %>
6 7
 	<%= content_tag(:div, class: 'container container-bg mission-detail-container') do %>

+ 1 - 2
app/views/missions/edit.html.erb

@@ -1,6 +1,5 @@
1 1
 <%= render :partial => 'mission_editor_tabs' %>
2
-
3
-
2
+<%= render :partial => 'layouts/flash' %>
4 3
 
5 4
 <%= content_tag(:div, class: 'container-bg') do %>
6 5
 	<%= content_tag(:div, class: 'container container-bg mission-detail-container') do %>

+ 1 - 1
app/views/missions/index.html.erb

@@ -1,7 +1,7 @@
1 1
 <%= content_tag(:div, class: 'container top-container') do %>
2 2
 	<%= content_tag(:div, class: 'row') do %>
3 3
 		<%= content_tag(:div, class: 'span12') do %>
4
-			<%= bootstrap_flash %>
4
+			<%= render :partial => 'layouts/flash' %>
5 5
 
6 6
 			<% # Page Content %>
7 7
 

+ 2 - 0
app/views/missions/mission_control.html.erb

@@ -1,6 +1,8 @@
1 1
 <%= render :partial => "mission_details", locals: {mission: @mission} %>
2 2
 <%= render :partial => 'mission_tabs', locals: {mission: @mission} %>
3 3
 
4
+<%= render :partial => 'layouts/flash' %>
5
+
4 6
 <% # Content -------- %>
5 7
 
6 8
 <%= content_tag(:div, class: 'container container-last') do %>

+ 1 - 2
app/views/missions/new.html.erb

@@ -1,6 +1,5 @@
1 1
 <%= render :partial => 'mission_editor_tabs' %>
2
-
3
-
2
+<%= render :partial => 'layouts/flash' %>
4 3
 
5 4
 <%= content_tag(:div, class: 'container-bg') do %>
6 5
 	<%= content_tag(:div, class: 'container container-bg mission-detail-container') do %>

+ 1 - 1
app/views/missions/show.html.erb

@@ -1,6 +1,6 @@
1 1
 <%= render :partial => "mission_details", locals: {mission: @mission} %>
2 2
 <%= render :partial => 'mission_tabs', locals: {mission: @mission} %>
3
-
3
+<%= render :partial => 'layouts/flash' %>
4 4
 
5 5
 <%= content_tag(:div, class: 'container container-last') do %>
6 6
 	<%= content_tag(:div, class: 'row') do %>

+ 1 - 0
app/views/missions/show_agent_details.html.erb

@@ -1,5 +1,6 @@
1 1
 <%= render :partial => "mission_details", locals: {mission: @mission} %>
2 2
 <%= render :partial => 'mission_tabs', locals: {mission: @mission} %>
3
+<%= render :partial => 'layouts/flash' %>
3 4
 
4 5
 
5 6
 <% # Content -------- %>

+ 1 - 1
app/views/missions/show_agents.html.erb

@@ -1,6 +1,6 @@
1 1
 <%= render :partial => "mission_details", locals: {mission: @mission} %>
2 2
 <%= render :partial => 'mission_tabs', locals: {mission: @mission} %>
3
-
3
+<%= render :partial => 'layouts/flash' %>
4 4
 
5 5
 <% # Content -------- %>
6 6