customization log css modify
This commit is contained in:
parent
9599283586
commit
42a7f1a192
|
@ -22,7 +22,7 @@ class Admin::CustomizationLogsController < OrbitAdminController
|
|||
|
||||
def get_log
|
||||
@site = RegisteredSite.find(params[:id])
|
||||
@logs = @site.site_logs.desc(:created_at)
|
||||
@logs = @site.site_logs.where(:archive.ne => true).desc(:created_at)
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
|
@ -31,6 +31,13 @@ class Admin::CustomizationLogsController < OrbitAdminController
|
|||
@site = RegisteredSite.find(params[:id])
|
||||
end
|
||||
|
||||
def archive
|
||||
log = SiteLog.find(params[:id])
|
||||
log.archive = true
|
||||
log.save
|
||||
render :json => {"success" => true}.to_json
|
||||
end
|
||||
|
||||
def update
|
||||
log = SiteLog.find(params[:id])
|
||||
log.update_attributes(site_log_params)
|
||||
|
|
|
@ -4,6 +4,7 @@ class SiteLog
|
|||
|
||||
field :title
|
||||
field :content
|
||||
field :archive, type: Boolean, default: false
|
||||
field :create_user_id, type: BSON::ObjectId
|
||||
field :update_user_id, type: BSON::ObjectId
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if !site.site_logs.blank? %>
|
||||
<% if site.site_logs.where(:archive.ne => true).count > 0 %>
|
||||
<a data-toggle="modal" href="/admin/customization_logs/<%= site.id.to_s %>/get_log" data-target="#logModal" class="btn view_log_btn">View Log</a>
|
||||
<% end %>
|
||||
<a href="<%= new_admin_customization_log_path(:id => site.id) %>" class="btn btn-primary">Add Log</a>
|
||||
|
|
|
@ -1,46 +1,47 @@
|
|||
<% @logs.each_with_index do |log, i| %>
|
||||
<div class="row">
|
||||
<div class="span9">
|
||||
<div class="row">
|
||||
<div class="span2 muted">Author :</div>
|
||||
<% user = User.find(log.create_user_id) %>
|
||||
<div class="span7"><%= user.member_profile.nil? ? user.user_name : user.member_profile.name %></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="span2 muted">Date :</div>
|
||||
<div class="span7"><%= log.created_at %></div>
|
||||
</div>
|
||||
<% if !log.update_user_id.nil? %>
|
||||
<div class="row">
|
||||
<div class="span2 muted">Updated by :</div>
|
||||
<% user = User.find(log.update_user_id) %>
|
||||
<div class="span7"><%= user.member_profile.nil? ? user.user_name : user.member_profile.name %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="span2 muted">Title :</div>
|
||||
<div class="span7"><%= log.title %></div>
|
||||
</div>
|
||||
<% if !log.site_log_files.blank? %>
|
||||
<div class="row">
|
||||
<% log.site_log_files.each_with_index do |file,index| %>
|
||||
<div class="span2 muted"><%= index == 0 ? "Files" : "" %></div>
|
||||
<div class="span7">
|
||||
<%= link_to (file.title.nil? || file.title == "" ? file.file_identifier : file.title), file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => file.file_identifier} %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row">
|
||||
<div class="span2 muted">Content :</div>
|
||||
<div class="span7"><%= log.content.html_safe %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="span9" style="text-align:center;font-size:15px;"><a href="<%= edit_admin_customization_log_path(log) %>">Edit</a></div>
|
||||
</div>
|
||||
<% if i != (@logs.length - 1) %>
|
||||
<hr />
|
||||
<% end %>
|
||||
<div class="custom-log-item" id="log_<%= log.id.to_s %>">
|
||||
<div class="custom-log-row">
|
||||
<div class="custom-log-row-column-label muted">Author :</div>
|
||||
<% user = User.find(log.create_user_id) %>
|
||||
<div class="custom-log-row-column"><%= user.member_profile.nil? ? user.user_name : user.member_profile.name %></div>
|
||||
</div>
|
||||
<div class="custom-log-row">
|
||||
<div class="custom-log-row-column-label muted">Date :</div>
|
||||
<div class="custom-log-row-column"><%= log.created_at %></div>
|
||||
</div>
|
||||
<% if !log.update_user_id.nil? %>
|
||||
<div class="custom-log-row">
|
||||
<div class="custom-log-row-column-label muted">Updated by :</div>
|
||||
<% user = User.find(log.update_user_id) %>
|
||||
<div class="custom-log-row-column"><%= user.member_profile.nil? ? user.user_name : user.member_profile.name %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="custom-log-row">
|
||||
<div class="custom-log-row-column-label muted">Title :</div>
|
||||
<div class="custom-log-row-column"><%= log.title %></div>
|
||||
</div>
|
||||
<% if !log.site_log_files.blank? %>
|
||||
<div class="custom-log-row">
|
||||
<div class="custom-log-row-column-label muted">Files :</div>
|
||||
<div class="custom-log-row-column">
|
||||
<ul>
|
||||
<% log.site_log_files.each do |file| %>
|
||||
<li><%= link_to (file.title.nil? || file.title == "" ? file.file_identifier : file.title), file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => file.file_identifier} %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="custom-log-row">
|
||||
<div class="custom-log-row-column-label muted">Content :</div>
|
||||
<div class="custom-log-row-column"><%= log.content.html_safe %></div>
|
||||
</div>
|
||||
<div class="custom-log-edit">
|
||||
<a href="<%= edit_admin_customization_log_path(log) %>" class="btn btn-small btn-primary">Edit</a>
|
||||
<a href="<%= archive_admin_customization_log_path(log) %>" data-id="<%= log.id.to_s %>" class="btn btn-small btn-warning archive-btn">Archive</a>
|
||||
</div>
|
||||
</div>
|
||||
<% if i != (@logs.length - 1) %>
|
||||
<hr />
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -2,22 +2,88 @@
|
|||
<span id="index_table">
|
||||
<%= render 'index'%>
|
||||
</span>
|
||||
<style type="text/css">
|
||||
#logModal{
|
||||
width: 80%;
|
||||
margin-left: -40%;
|
||||
}
|
||||
#logModal .modal-body{
|
||||
max-height: 600px;
|
||||
}
|
||||
<style type="text/css">
|
||||
#logModal{
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
margin-left: -40%;
|
||||
}
|
||||
#logModal .modal-header {
|
||||
height: 71px;
|
||||
}
|
||||
#logModal .modal-body{
|
||||
max-height: none;
|
||||
position: absolute;
|
||||
top: 90px;
|
||||
right: 0;
|
||||
bottom: 60px;
|
||||
left: 0;
|
||||
}
|
||||
#logModal .modal-footer {
|
||||
height: 30px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
#logModal .custom-log-item {
|
||||
padding: 10px;
|
||||
}
|
||||
#logModal .custom-log-row {
|
||||
line-height: 2em;
|
||||
}
|
||||
#logModal .custom-log-row:after {
|
||||
content: "";
|
||||
clear: both;
|
||||
display: table;
|
||||
height: 0;
|
||||
}
|
||||
#logModal .custom-log-row-column-label {
|
||||
min-width: 12%;
|
||||
float: left;
|
||||
text-align: right;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#logModal .custom-log-row-column {
|
||||
float: left;
|
||||
width: 86%;
|
||||
padding-left: 2%;
|
||||
}
|
||||
#logModal .custom-log-row-column ul {
|
||||
margin-left: 10px;
|
||||
}
|
||||
#logModal .custom-log-row-column li {
|
||||
line-height: 2em;
|
||||
}
|
||||
#logModal .custom-log-edit {
|
||||
margin-top: 1em;
|
||||
padding-left: 14%
|
||||
}
|
||||
</style>
|
||||
<%= render "log_modal" %>
|
||||
<script type="text/javascript">
|
||||
var clicked_button = null;
|
||||
$(".view_log_btn").on("click",function(){
|
||||
clicked_button = $(this);
|
||||
})
|
||||
$("#logModal").on("shown",function(){
|
||||
$("#domain_title").html(clicked_button.parent().parent().find("td.domain_title_block").html());
|
||||
})
|
||||
var clicked_button = null;
|
||||
$(".view_log_btn").on("click",function(){
|
||||
clicked_button = $(this);
|
||||
})
|
||||
$("#logModal").on("shown",function(){
|
||||
$("#domain_title").html(clicked_button.parent().parent().find("td.domain_title_block").html());
|
||||
$(".archive-btn").on("click",function(){
|
||||
if(confirm("Archive this log?")){
|
||||
var el = $(this);
|
||||
$.ajax({
|
||||
"url" : el.attr("href"),
|
||||
"type" : "post",
|
||||
"dataType" : "json"
|
||||
}).done(function(d){
|
||||
$("#log_" + el.data("id")).slideUp(function(){
|
||||
$(this).remove();
|
||||
})
|
||||
})
|
||||
}
|
||||
return false;
|
||||
})
|
||||
})
|
||||
</script>
|
|
@ -9,6 +9,7 @@ Rails.application.routes.draw do
|
|||
resources :customization_logs do
|
||||
member do
|
||||
get "get_log" => "customization_logs#get_log"
|
||||
post "archive" => "customization_logs#archive"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue