customization log css modify
This commit is contained in:
parent
9599283586
commit
42a7f1a192
|
@ -22,7 +22,7 @@ class Admin::CustomizationLogsController < OrbitAdminController
|
||||||
|
|
||||||
def get_log
|
def get_log
|
||||||
@site = RegisteredSite.find(params[:id])
|
@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
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,6 +31,13 @@ class Admin::CustomizationLogsController < OrbitAdminController
|
||||||
@site = RegisteredSite.find(params[:id])
|
@site = RegisteredSite.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def archive
|
||||||
|
log = SiteLog.find(params[:id])
|
||||||
|
log.archive = true
|
||||||
|
log.save
|
||||||
|
render :json => {"success" => true}.to_json
|
||||||
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
log = SiteLog.find(params[:id])
|
log = SiteLog.find(params[:id])
|
||||||
log.update_attributes(site_log_params)
|
log.update_attributes(site_log_params)
|
||||||
|
|
|
@ -4,6 +4,7 @@ class SiteLog
|
||||||
|
|
||||||
field :title
|
field :title
|
||||||
field :content
|
field :content
|
||||||
|
field :archive, type: Boolean, default: false
|
||||||
field :create_user_id, type: BSON::ObjectId
|
field :create_user_id, type: BSON::ObjectId
|
||||||
field :update_user_id, type: BSON::ObjectId
|
field :update_user_id, type: BSON::ObjectId
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<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>
|
<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 %>
|
<% end %>
|
||||||
<a href="<%= new_admin_customization_log_path(:id => site.id) %>" class="btn btn-primary">Add Log</a>
|
<a href="<%= new_admin_customization_log_path(:id => site.id) %>" class="btn btn-primary">Add Log</a>
|
||||||
|
|
|
@ -1,45 +1,46 @@
|
||||||
<% @logs.each_with_index do |log, i| %>
|
<% @logs.each_with_index do |log, i| %>
|
||||||
<div class="row">
|
<div class="custom-log-item" id="log_<%= log.id.to_s %>">
|
||||||
<div class="span9">
|
<div class="custom-log-row">
|
||||||
<div class="row">
|
<div class="custom-log-row-column-label muted">Author :</div>
|
||||||
<div class="span2 muted">Author :</div>
|
|
||||||
<% user = User.find(log.create_user_id) %>
|
<% user = User.find(log.create_user_id) %>
|
||||||
<div class="span7"><%= user.member_profile.nil? ? user.user_name : user.member_profile.name %></div>
|
<div class="custom-log-row-column"><%= user.member_profile.nil? ? user.user_name : user.member_profile.name %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="custom-log-row">
|
||||||
<div class="span2 muted">Date :</div>
|
<div class="custom-log-row-column-label muted">Date :</div>
|
||||||
<div class="span7"><%= log.created_at %></div>
|
<div class="custom-log-row-column"><%= log.created_at %></div>
|
||||||
</div>
|
</div>
|
||||||
<% if !log.update_user_id.nil? %>
|
<% if !log.update_user_id.nil? %>
|
||||||
<div class="row">
|
<div class="custom-log-row">
|
||||||
<div class="span2 muted">Updated by :</div>
|
<div class="custom-log-row-column-label muted">Updated by :</div>
|
||||||
<% user = User.find(log.update_user_id) %>
|
<% user = User.find(log.update_user_id) %>
|
||||||
<div class="span7"><%= user.member_profile.nil? ? user.user_name : user.member_profile.name %></div>
|
<div class="custom-log-row-column"><%= user.member_profile.nil? ? user.user_name : user.member_profile.name %></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="row">
|
<div class="custom-log-row">
|
||||||
<div class="span2 muted">Title :</div>
|
<div class="custom-log-row-column-label muted">Title :</div>
|
||||||
<div class="span7"><%= log.title %></div>
|
<div class="custom-log-row-column"><%= log.title %></div>
|
||||||
</div>
|
</div>
|
||||||
<% if !log.site_log_files.blank? %>
|
<% if !log.site_log_files.blank? %>
|
||||||
<div class="row">
|
<div class="custom-log-row">
|
||||||
<% log.site_log_files.each_with_index do |file,index| %>
|
<div class="custom-log-row-column-label muted">Files :</div>
|
||||||
<div class="span2 muted"><%= index == 0 ? "Files" : "" %></div>
|
<div class="custom-log-row-column">
|
||||||
<div class="span7">
|
<ul>
|
||||||
<%= 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} %>
|
<% 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>
|
</div>
|
||||||
<% end %>
|
<% 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>
|
||||||
<% end %>
|
<div class="custom-log-edit">
|
||||||
<div class="row">
|
<a href="<%= edit_admin_customization_log_path(log) %>" class="btn btn-small btn-primary">Edit</a>
|
||||||
<div class="span2 muted">Content :</div>
|
<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 class="span7"><%= log.content.html_safe %></div>
|
|
||||||
</div>
|
</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) %>
|
<% if i != (@logs.length - 1) %>
|
||||||
<hr />
|
<hr />
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -5,10 +5,61 @@
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#logModal{
|
#logModal{
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
height: 80%;
|
||||||
margin-left: -40%;
|
margin-left: -40%;
|
||||||
}
|
}
|
||||||
|
#logModal .modal-header {
|
||||||
|
height: 71px;
|
||||||
|
}
|
||||||
#logModal .modal-body{
|
#logModal .modal-body{
|
||||||
max-height: 600px;
|
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>
|
</style>
|
||||||
<%= render "log_modal" %>
|
<%= render "log_modal" %>
|
||||||
|
@ -19,5 +70,20 @@
|
||||||
})
|
})
|
||||||
$("#logModal").on("shown",function(){
|
$("#logModal").on("shown",function(){
|
||||||
$("#domain_title").html(clicked_button.parent().parent().find("td.domain_title_block").html());
|
$("#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>
|
</script>
|
|
@ -9,6 +9,7 @@ Rails.application.routes.draw do
|
||||||
resources :customization_logs do
|
resources :customization_logs do
|
||||||
member do
|
member do
|
||||||
get "get_log" => "customization_logs#get_log"
|
get "get_log" => "customization_logs#get_log"
|
||||||
|
post "archive" => "customization_logs#archive"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue