Commit 0e45fccc by tady

header/notify css

parent e4b455c6
......@@ -4,8 +4,6 @@
.app {
padding-top: 70px;
.navbar-default .navbar-brand {
background-color: #428bca;
color: #fff;
......
body[class^="posts-"] {
padding-top: 70px;
}
......@@ -13,5 +13,4 @@ class ApplicationController < ActionController::Base
rescue_from(ActionController::ParameterMissing) do |parameter_missing_exception|
render text: "Required parameter missing: #{parameter_missing_exception.param}", status: :bad_request
end
end
......@@ -48,11 +48,11 @@ class PostsController < ApplicationController
current_user.google_oauth_token_refresh! if current_user.google_oauth_token_expired?
compose_mail(@post, user: current_user, to: mail_params[:to]).deliver
redirect_to root_path(id: @post.id)
redirect_to root_path(id: @post.id), flash: { success: 'Mail has sent!' }
rescue ActionGmailer::DeliveryError
redirect_to root_path(id: @post.id), flash: { notice: 'Gmail authentication expired.' }
rescue ArgumentError => err
render text: err.to_s, status: :bad_request
redirect_to root_path(id: @post.id), flash: { alert: 'Mail format is invalid: ' + err.to_s }
end
# GET /posts/1/edit
......@@ -67,7 +67,7 @@ class PostsController < ApplicationController
respond_to do |format|
if @post.save
format.html { redirect_to root_path(id: @post.id), notice: 'Post was successfully created.' }
format.html { redirect_to root_path(id: @post.id), flash: { notice: 'Post was successfully created.' } }
format.json { render action: 'show', status: :created, location: @post }
else
format.html { render action: 'new' }
......@@ -83,7 +83,7 @@ class PostsController < ApplicationController
respond_to do |format|
if @post.update(post_params)
format.html { redirect_to root_path(id: @post.id), notice: 'Post was successfully updated.' }
format.html { redirect_to root_path(id: @post.id), flash: { notice: 'Post was successfully updated.' } }
format.json { head :no_content }
else
format.html { render action: 'edit' }
......@@ -97,7 +97,7 @@ class PostsController < ApplicationController
def destroy
@post.destroy
respond_to do |format|
format.html { redirect_to posts_url }
format.html { redirect_to posts_url, flash: { success: 'Post successfully deleted.' }}
format.json { head :no_content }
end
end
......
......@@ -11,7 +11,9 @@
<%= csrf_meta_tags %>
</head>
<body>
<body class="<%= params[:controller] %>-<%= params[:action] %>">
<%= render partial: 'partials/header_notifications' %>
<%= yield %>
......
<% if notice %>
<% if flash[:success] %>
<div class="alert alert-success fade in">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<strong>Success</strong> <%= flash[:success] %>
</div>
<% end %>
<% if flash[:notice] %>
<div class="alert alert-warning fade in">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<strong>Notice</strong> <%= notice %>
<strong>Notice</strong> <%= flash[:notice] %>
</div>
<% end %>
<% if alert %>
<% if flash[:alert] %>
<div class="alert alert-danger fade in">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<strong>Alert</strong> <%= alert %>
<strong>Alert</strong> <%= flash[:alert] %>
</div>
<% end %>
......@@ -5,14 +5,14 @@
<div class="text-box meta">
<% @post.tags.each do |tag| %>
<span class="label label-info">
<a href="<%= root_path(q: "##{tag.name}") %>">#<%= tag.name %></a>
<a href="<%= posts_path(q: "##{tag.name}") %>">#<%= tag.name %></a>
</span>
<% end %>
<span class="label label-success">
<a href="<%= root_path(q: "@#{@post.author.name}") %>">@<%= @post.author.name %></a>
<a href="<%= posts_path(q: "@#{@post.author.name}") %>">@<%= @post.author.name %></a>
</span>
<span class="label label-danger">
<a href="<%= root_path(q: "date:#{@post.updated_at.strftime('%Y-%m-%d')}") %>"><%= @post.updated_at.strftime('%Y-%m-%d') %></a>
<a href="<%= posts_path(q: "date:#{@post.updated_at.strftime('%Y-%m-%d')}") %>"><%= @post.updated_at.strftime('%Y-%m-%d') %></a>
</span>
<!-- Split button -->
......
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