Merge with branch november_presentation
|
@ -4,3 +4,14 @@ db/*.sqlite3
|
|||
log/*.log
|
||||
tmp/**/*
|
||||
public/uploads/**/*
|
||||
uploads/**/*
|
||||
|
||||
.DS_Store
|
||||
|
||||
*.swp
|
||||
|
||||
public/javascripts
|
||||
public/stylesheets
|
||||
config/application.rb
|
||||
|
||||
.rvmrc
|
||||
|
|
24
Gemfile
|
@ -1,21 +1,33 @@
|
|||
source 'http://rubygems.org'
|
||||
|
||||
gem 'rails', '3.0.6'
|
||||
gem 'rails'
|
||||
gem 'yajl-ruby', :require => 'yajl'
|
||||
|
||||
gem 'bson_ext'
|
||||
gem 'carrierwave'
|
||||
gem 'carrierwave', '0.5.4'
|
||||
gem 'ckeditor'
|
||||
gem 'devise'
|
||||
gem 'mini_magick'
|
||||
gem 'rubyzip'
|
||||
gem 'sinatra'
|
||||
gem 'execjs'
|
||||
gem 'mongoid'
|
||||
|
||||
gem 'mongoid', '2.0.0'
|
||||
gem 'rake'
|
||||
gem 'jquery-rails'
|
||||
|
||||
gem 'rake', '0.8.7'
|
||||
gem 'sprockets'
|
||||
|
||||
# Gems used only for assets and not required
|
||||
# in production environments by default.
|
||||
group :assets do
|
||||
gem 'sass-rails'
|
||||
gem 'coffee-rails'
|
||||
gem 'uglifier'
|
||||
end
|
||||
|
||||
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
|
||||
# gem 'ruby-debug'
|
||||
# gem 'ruby-debug19'
|
||||
gem 'ruby-debug19'
|
||||
|
||||
group :test, :development do
|
||||
gem "rspec", "~> 2.0"
|
||||
|
|
254
Gemfile.lock
|
@ -1,136 +1,204 @@
|
|||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
abstract (1.0.0)
|
||||
actionmailer (3.0.6)
|
||||
actionpack (= 3.0.6)
|
||||
mail (~> 2.2.15)
|
||||
actionpack (3.0.6)
|
||||
activemodel (= 3.0.6)
|
||||
activesupport (= 3.0.6)
|
||||
builder (~> 2.1.2)
|
||||
erubis (~> 2.6.6)
|
||||
i18n (~> 0.5.0)
|
||||
rack (~> 1.2.1)
|
||||
rack-mount (~> 0.6.14)
|
||||
rack-test (~> 0.5.7)
|
||||
tzinfo (~> 0.3.23)
|
||||
activemodel (3.0.6)
|
||||
activesupport (= 3.0.6)
|
||||
builder (~> 2.1.2)
|
||||
i18n (~> 0.5.0)
|
||||
activerecord (3.0.6)
|
||||
activemodel (= 3.0.6)
|
||||
activesupport (= 3.0.6)
|
||||
arel (~> 2.0.2)
|
||||
tzinfo (~> 0.3.23)
|
||||
activeresource (3.0.6)
|
||||
activemodel (= 3.0.6)
|
||||
activesupport (= 3.0.6)
|
||||
activesupport (3.0.6)
|
||||
arel (2.0.10)
|
||||
bcrypt-ruby (2.1.4-x86-mingw32)
|
||||
bson (1.3.1)
|
||||
bson_ext (1.3.1)
|
||||
builder (2.1.2)
|
||||
actionmailer (3.1.1)
|
||||
actionpack (= 3.1.1)
|
||||
mail (~> 2.3.0)
|
||||
actionpack (3.1.1)
|
||||
activemodel (= 3.1.1)
|
||||
activesupport (= 3.1.1)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
i18n (~> 0.6)
|
||||
rack (~> 1.3.2)
|
||||
rack-cache (~> 1.1)
|
||||
rack-mount (~> 0.8.2)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.0.2)
|
||||
activemodel (3.1.1)
|
||||
activesupport (= 3.1.1)
|
||||
builder (~> 3.0.0)
|
||||
i18n (~> 0.6)
|
||||
activerecord (3.1.1)
|
||||
activemodel (= 3.1.1)
|
||||
activesupport (= 3.1.1)
|
||||
arel (~> 2.2.1)
|
||||
tzinfo (~> 0.3.29)
|
||||
activeresource (3.1.1)
|
||||
activemodel (= 3.1.1)
|
||||
activesupport (= 3.1.1)
|
||||
activesupport (3.1.1)
|
||||
multi_json (~> 1.0)
|
||||
archive-tar-minitar (0.5.2)
|
||||
arel (2.2.1)
|
||||
bcrypt-ruby (3.0.1)
|
||||
bson (1.4.1)
|
||||
bson_ext (1.4.1)
|
||||
builder (3.0.0)
|
||||
carrierwave (0.5.4)
|
||||
activesupport (~> 3.0)
|
||||
chronic (0.3.0)
|
||||
ckeditor (3.5.4)
|
||||
mime-types (>= 1.16)
|
||||
delorean (1.0.0)
|
||||
chronic (0.6.4)
|
||||
ckeditor (3.6.3)
|
||||
mime-types (~> 1.16)
|
||||
orm_adapter (~> 0.0.5)
|
||||
coffee-rails (3.1.1)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (~> 3.1.0)
|
||||
coffee-script (2.2.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.1.2)
|
||||
columnize (0.3.4)
|
||||
delorean (1.1.0)
|
||||
chronic
|
||||
devise (1.3.4)
|
||||
bcrypt-ruby (~> 2.1.2)
|
||||
devise (1.4.8)
|
||||
bcrypt-ruby (~> 3.0)
|
||||
orm_adapter (~> 0.0.3)
|
||||
warden (~> 1.0.3)
|
||||
diff-lcs (1.1.2)
|
||||
erubis (2.6.6)
|
||||
abstract (>= 1.0.0)
|
||||
factory_girl (1.3.3)
|
||||
factory_girl_rails (1.0.1)
|
||||
factory_girl (~> 1.3)
|
||||
diff-lcs (1.1.3)
|
||||
erubis (2.7.0)
|
||||
execjs (1.2.9)
|
||||
multi_json (~> 1.0)
|
||||
factory_girl (2.2.0)
|
||||
activesupport
|
||||
factory_girl_rails (1.3.0)
|
||||
factory_girl (~> 2.2.0)
|
||||
railties (>= 3.0.0)
|
||||
i18n (0.5.0)
|
||||
mail (2.2.19)
|
||||
activesupport (>= 2.3.6)
|
||||
hike (1.2.1)
|
||||
i18n (0.6.0)
|
||||
jquery-rails (1.0.16)
|
||||
railties (~> 3.0)
|
||||
thor (~> 0.14)
|
||||
json (1.6.1)
|
||||
linecache19 (0.5.12)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
mail (2.3.0)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
mime-types (1.16)
|
||||
mini_magick (3.2.1)
|
||||
subexec (~> 0.0.4)
|
||||
mongo (1.3.1)
|
||||
bson (>= 1.3.1)
|
||||
mongoid (2.0.0)
|
||||
activemodel (~> 3.0)
|
||||
mongo (~> 1.2)
|
||||
mini_magick (3.3)
|
||||
subexec (~> 0.1.0)
|
||||
mongo (1.4.1)
|
||||
bson (= 1.4.1)
|
||||
mongoid (2.3.2)
|
||||
activemodel (~> 3.1)
|
||||
mongo (~> 1.4)
|
||||
tzinfo (~> 0.3.22)
|
||||
will_paginate (~> 3.0.pre)
|
||||
multi_json (1.0.3)
|
||||
orm_adapter (0.0.5)
|
||||
polyglot (0.3.1)
|
||||
rack (1.2.3)
|
||||
rack-mount (0.6.14)
|
||||
polyglot (0.3.2)
|
||||
rack (1.3.4)
|
||||
rack-cache (1.1)
|
||||
rack (>= 0.4)
|
||||
rack-mount (0.8.3)
|
||||
rack (>= 1.0.0)
|
||||
rack-test (0.5.7)
|
||||
rack-protection (1.1.4)
|
||||
rack
|
||||
rack-ssl (1.3.2)
|
||||
rack
|
||||
rack-test (0.6.1)
|
||||
rack (>= 1.0)
|
||||
rails (3.0.6)
|
||||
actionmailer (= 3.0.6)
|
||||
actionpack (= 3.0.6)
|
||||
activerecord (= 3.0.6)
|
||||
activeresource (= 3.0.6)
|
||||
activesupport (= 3.0.6)
|
||||
rails (3.1.1)
|
||||
actionmailer (= 3.1.1)
|
||||
actionpack (= 3.1.1)
|
||||
activerecord (= 3.1.1)
|
||||
activeresource (= 3.1.1)
|
||||
activesupport (= 3.1.1)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.0.6)
|
||||
railties (3.0.6)
|
||||
actionpack (= 3.0.6)
|
||||
activesupport (= 3.0.6)
|
||||
railties (= 3.1.1)
|
||||
railties (3.1.1)
|
||||
actionpack (= 3.1.1)
|
||||
activesupport (= 3.1.1)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
thor (~> 0.14.4)
|
||||
rake (0.8.7)
|
||||
rcov (0.9.9)
|
||||
rspec (2.6.0)
|
||||
rspec-core (~> 2.6.0)
|
||||
rspec-expectations (~> 2.6.0)
|
||||
rspec-mocks (~> 2.6.0)
|
||||
rspec-core (2.6.3)
|
||||
rspec-expectations (2.6.0)
|
||||
rdoc (~> 3.4)
|
||||
thor (~> 0.14.6)
|
||||
rake (0.9.2)
|
||||
rcov (0.9.11)
|
||||
rdoc (3.11)
|
||||
json (~> 1.4)
|
||||
rspec (2.7.0)
|
||||
rspec-core (~> 2.7.0)
|
||||
rspec-expectations (~> 2.7.0)
|
||||
rspec-mocks (~> 2.7.0)
|
||||
rspec-core (2.7.0)
|
||||
rspec-expectations (2.7.0)
|
||||
diff-lcs (~> 1.1.2)
|
||||
rspec-mocks (2.6.0)
|
||||
rspec-rails (2.6.1)
|
||||
rspec-mocks (2.7.0)
|
||||
rspec-rails (2.7.0)
|
||||
actionpack (~> 3.0)
|
||||
activesupport (~> 3.0)
|
||||
railties (~> 3.0)
|
||||
rspec (~> 2.6.0)
|
||||
shoulda-matchers (1.0.0.beta2)
|
||||
subexec (0.0.4)
|
||||
rspec (~> 2.7.0)
|
||||
ruby-debug-base19 (0.11.25)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
ruby-debug19 (0.11.6)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby-debug-base19 (>= 0.11.19)
|
||||
ruby_core_source (0.1.5)
|
||||
archive-tar-minitar (>= 0.5.2)
|
||||
rubyzip (0.9.4)
|
||||
sass (3.1.10)
|
||||
sass-rails (3.1.4)
|
||||
actionpack (~> 3.1.0)
|
||||
railties (~> 3.1.0)
|
||||
sass (>= 3.1.4)
|
||||
sprockets (~> 2.0.0)
|
||||
tilt (~> 1.3.2)
|
||||
shoulda-matchers (1.0.0.beta3)
|
||||
sinatra (1.3.1)
|
||||
rack (~> 1.3, >= 1.3.4)
|
||||
rack-protection (~> 1.1, >= 1.1.2)
|
||||
tilt (~> 1.3, >= 1.3.3)
|
||||
sprockets (2.0.3)
|
||||
hike (~> 1.2)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
subexec (0.1.0)
|
||||
thor (0.14.6)
|
||||
treetop (1.4.9)
|
||||
tilt (1.3.3)
|
||||
treetop (1.4.10)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.27)
|
||||
warden (1.0.4)
|
||||
tzinfo (0.3.30)
|
||||
uglifier (1.0.3)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (>= 1.0.2)
|
||||
warden (1.0.6)
|
||||
rack (>= 1.0)
|
||||
watchr (0.7)
|
||||
will_paginate (3.0.pre2)
|
||||
yajl-ruby (0.8.2)
|
||||
yajl-ruby (1.0.0)
|
||||
|
||||
PLATFORMS
|
||||
x86-mingw32
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
bson_ext
|
||||
carrierwave
|
||||
carrierwave (= 0.5.4)
|
||||
ckeditor
|
||||
coffee-rails
|
||||
delorean
|
||||
devise
|
||||
execjs
|
||||
factory_girl_rails
|
||||
jquery-rails
|
||||
mini_magick
|
||||
mongoid (= 2.0.0)
|
||||
rails (= 3.0.6)
|
||||
rake (= 0.8.7)
|
||||
mongoid
|
||||
rails
|
||||
rake
|
||||
rcov
|
||||
rspec (~> 2.0)
|
||||
rspec-rails (~> 2.0)
|
||||
ruby-debug19
|
||||
rubyzip
|
||||
sass-rails
|
||||
shoulda-matchers
|
||||
sinatra
|
||||
sprockets
|
||||
uglifier
|
||||
watchr
|
||||
yajl-ruby
|
||||
|
|
After Width: | Height: | Size: 923 B |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 157 B After Width: | Height: | Size: 157 B |
After Width: | Height: | Size: 211 B |
After Width: | Height: | Size: 393 B |
After Width: | Height: | Size: 499 B |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 504 B |
After Width: | Height: | Size: 724 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 798 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 958 B |
Before Width: | Height: | Size: 857 B After Width: | Height: | Size: 857 B |
After Width: | Height: | Size: 964 B |
After Width: | Height: | Size: 116 B |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 447 B |
After Width: | Height: | Size: 386 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1010 B |
After Width: | Height: | Size: 1010 B |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 181 B |
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 184 B |
After Width: | Height: | Size: 963 B |
After Width: | Height: | Size: 841 KiB |
|
@ -1,3 +1,13 @@
|
|||
// This is a manifest file that'll be compiled into including all the files listed below.
|
||||
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
||||
// be included in the compiled file accessible from http://example.com/assets/application.js
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// the compiled file.
|
||||
//
|
||||
//= require jquery
|
||||
//= require jquery_ujs
|
||||
//= require_tree .
|
||||
|
||||
// Place your application-specific JavaScript functions and classes here
|
||||
// This file is automatically included by javascript_include_tag :defaults
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -0,0 +1,71 @@
|
|||
function r_editor(tgetUrl,tpostUrl,tfilename,toption){
|
||||
if(!toption){ toption =new Array();}
|
||||
if(!toption['width']){toption['width']=400;}
|
||||
if(!toption['height']){toption['height']=300;}
|
||||
var editor = this;
|
||||
editor.filename = tfilename;
|
||||
editor.getUrl = tgetUrl;
|
||||
editor.postUrl = tpostUrl;
|
||||
editor.nodeToBeChanged=""
|
||||
editor.width = toption['width'];
|
||||
editor.height = toption['height'];
|
||||
var html='';
|
||||
editor.init = function(){
|
||||
code = "<span id='file_editor' style='border:solid; width:"+editor.width+"px;height:"+editor.height+"px; float:right;' ><textarea style='height:87%;width:97%;resize:none;border:none;' ></textarea><input type='button' class='send' value='Send' ><input type='button' class='discard' value='Discard' ></span>";
|
||||
html = $(code);
|
||||
html.children("textarea").load(editor.getUrl);
|
||||
html.children("input.discard").click(function(){
|
||||
editor.destroy();
|
||||
});
|
||||
html.children("input.send").click(function(){
|
||||
editor.send();
|
||||
});
|
||||
return html;
|
||||
};
|
||||
editor.reload = function(){
|
||||
$.get(editor.getUrl,function(data){
|
||||
html.children("textarea").text(data);
|
||||
});
|
||||
};
|
||||
editor.send = function(){
|
||||
$.post(editor.postUrl,{filename:editor.filename,context:html.children("textarea").val(),authenticity_token:$('meta[name=csrf-token]').attr('content')},null,"script");
|
||||
};
|
||||
editor.destroy = function(){
|
||||
html.remove();
|
||||
};
|
||||
}
|
||||
|
||||
$(".r_edit").live("click",function(){
|
||||
new_editor = new r_editor($(this).attr("path"),"edit_file",$(this).attr("filename"));
|
||||
$(this).after(new_editor.init());
|
||||
});
|
||||
|
||||
|
||||
$(".r_snapshot").live({
|
||||
mouseenter:
|
||||
function(){
|
||||
$(this).append($("<span></span>").html('<p class="z-preview"><img src="'+$(this).attr("path")+'"width="220" height="19" /></p>'));
|
||||
},
|
||||
mouseleave:
|
||||
function(){
|
||||
$(this).find("span:last").remove();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$('input.multi_files').live("change", function(){
|
||||
$(this).parent().prev("ul").append("<li>" + $(this).val() + "</li>");
|
||||
new_node = $(this).parent().clone();
|
||||
$(this).parent().css("display","none");
|
||||
new_node.children('input.multi_files').val("");
|
||||
$(this).parent().before(new_node);
|
||||
});
|
||||
|
||||
$('a.remove_mark').live("click",function(){
|
||||
$(this).prev("input").val("true");
|
||||
$(this).parent().css("text-decoration","line-through")
|
||||
$(this).parent().removeClass("r_snapshot");
|
||||
$(this).next().remove();
|
||||
$(this).remove();
|
||||
return false;
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
$("#page_design_id").live('change', function() {
|
||||
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes');
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
$(function (){
|
||||
$(".engine_loading").load($(this).attr("widget_path"));
|
||||
});
|
|
@ -0,0 +1,354 @@
|
|||
html, body{
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
html{
|
||||
background: url(<%= asset_path "body.jpg" %>) no-repeat scroll 0 0 transparent;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
body{
|
||||
color: #000000;
|
||||
font-family: helvetica,arial,sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#panel_banner_link{
|
||||
background: url(<%= asset_path "orbitbar1.png" %>) repeat-x scroll 0 0;
|
||||
height: 52px;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.hmenu{
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 1px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
|
||||
#orbit{
|
||||
background: url(<%= asset_path "bar_orbit.png" %>) no-repeat scroll 0 0 transparent;
|
||||
cursor:pointer;
|
||||
height: 43px;
|
||||
left: 10px;
|
||||
position: relative;
|
||||
width: 41px;
|
||||
}
|
||||
|
||||
#orbit:hover{
|
||||
background-position:0 -43px;
|
||||
box-shadow: 0 3px 3px #000000;
|
||||
}
|
||||
#orbit:hover #orblist{
|
||||
display:block;
|
||||
}
|
||||
#orblist{
|
||||
background: none repeat scroll 0 0 #FFFFFF;
|
||||
border-radius: 0 3px 3px 3px;
|
||||
box-shadow: 0 3px 3px #000000;
|
||||
display: none;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
position: absolute;
|
||||
top: 43px;
|
||||
width: 130px;
|
||||
}
|
||||
#orblist li{
|
||||
border-bottom:1px solid #aaa;
|
||||
list-style:none;
|
||||
}
|
||||
.orblink{
|
||||
color: #333333;
|
||||
display: block;
|
||||
font: 12px/100% arial,sans-serif;
|
||||
padding: 5px;
|
||||
text-decoration: none;
|
||||
}
|
||||
.orblink:hover{
|
||||
background:#eee;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
#log_out a{
|
||||
background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right 0 transparent;
|
||||
border: medium none !important;
|
||||
display: block !important;
|
||||
height: 40px !important;
|
||||
line-height: normal !important;
|
||||
padding: 0 !important;
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
text-indent: -10000px;
|
||||
top: 0px;
|
||||
width: 43px !important;
|
||||
}
|
||||
#log_out a:hover{
|
||||
background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right bottom transparent !important;
|
||||
}
|
||||
.lang{
|
||||
color: #FFFFFF;
|
||||
font-size: 15px;
|
||||
line-height: 40px;
|
||||
position: absolute;
|
||||
right: 55px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.lang a{
|
||||
color:#fff;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
.lang a:hover{
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
#panel_container{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#panel_container h1{
|
||||
color: #FFFFFF;
|
||||
font: 32px/100% helvetica,arial,sans-serif;
|
||||
margin: 0 0 20px;
|
||||
padding: 0;
|
||||
text-shadow: 0 0 5px #000000;
|
||||
}
|
||||
|
||||
#panel_header{
|
||||
background: none repeat scroll 0 0 #F1F1F1;
|
||||
border-bottom: 1px solid #818181;
|
||||
padding: 10px;
|
||||
}
|
||||
#panel_header :after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
#panel_header #nav{
|
||||
margin:0;
|
||||
padding:0;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
#panel_header #nav li{
|
||||
float: left;
|
||||
list-style: none outside none;
|
||||
}
|
||||
|
||||
#panel_header #nav li a{
|
||||
background: none repeat scroll 0 0 #fff;
|
||||
border-radius: 13px 13px 13px 13px;
|
||||
border: 1px solid #D6D6D6;
|
||||
color: #000000;
|
||||
float: left;
|
||||
font-size:15px;
|
||||
margin: 0 20px 0 0;
|
||||
padding: 5px 10px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#panel_header #nav li a:hover{
|
||||
background: none repeat scroll 0 0 #818181;
|
||||
border-radius: 13px 13px 13px 13px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#panel_content{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.main{
|
||||
float: left;
|
||||
height: 100%;
|
||||
padding: 0 1%;
|
||||
width: 81%;
|
||||
}
|
||||
.main2{
|
||||
padding: 62px 0 0;
|
||||
}
|
||||
.main table{
|
||||
border-collapse: collapse;
|
||||
width:100%;
|
||||
}
|
||||
.main table th{
|
||||
border-bottom: 1px solid #222222;
|
||||
color: #FFFFFF;
|
||||
font: 20px/100% helvetica,arial,sans-serif;
|
||||
letter-spacing: 0.05em;
|
||||
padding: 10px;
|
||||
text-shadow: 0 0 3px #000000;
|
||||
}
|
||||
.main table td{
|
||||
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5);
|
||||
border-bottom: 1px solid #222222;
|
||||
color: #FFFFFF;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.main table td a{
|
||||
background: none repeat scroll 0 0 #FFFFFF;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
color: #000000;
|
||||
padding: 5px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.main table td a:hover{
|
||||
background: none repeat scroll 0 0 #eee;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
color: #333;
|
||||
}
|
||||
.secondary{
|
||||
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.75);
|
||||
box-shadow: 3px 0 3px #000000;
|
||||
float: left;
|
||||
height: 100%;
|
||||
padding: 0 1%;
|
||||
width: 14%;
|
||||
}
|
||||
.secondary2{
|
||||
padding: 62px 0 0;
|
||||
}
|
||||
.secondary ul{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.secondary ul li{
|
||||
list-style:none;
|
||||
}
|
||||
.secondary ul li a{
|
||||
border-bottom: 1px solid #333;
|
||||
color: #AAAAAA;
|
||||
display: block;
|
||||
padding: 14px 0;
|
||||
text-align: left;
|
||||
text-decoration: none;
|
||||
}
|
||||
.seclink1{
|
||||
background: url(<%= asset_path "icon1.png" %>) no-repeat scroll 20px 8px transparent;
|
||||
border-bottom: 1px solid #333;
|
||||
color: #AAAAAA;
|
||||
display: block;
|
||||
padding: 14px 0 14px 60px !important;
|
||||
text-align: left;
|
||||
text-decoration: none;
|
||||
}
|
||||
.seclink2{
|
||||
background: url(<%= asset_path "icon2.png" %>) no-repeat scroll 20px 14px transparent;
|
||||
border-bottom: 1px solid #333;
|
||||
color: #AAAAAA;
|
||||
display: block;
|
||||
padding: 14px 0 14px 60px !important;
|
||||
text-align: left;
|
||||
text-decoration: none;
|
||||
}
|
||||
.secondary ul li a:hover{
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#panel_footer{
|
||||
background: none repeat scroll 0 0 #FFFFFF;
|
||||
display:none;
|
||||
clear: both;
|
||||
padding: 10px;
|
||||
}
|
||||
#panel_footer p{
|
||||
margin:0;
|
||||
}
|
||||
label{
|
||||
color: #FFFFFF;
|
||||
display: block;
|
||||
text-shadow: 0 0 5px #000000;
|
||||
width: 130px;
|
||||
}
|
||||
p{
|
||||
margin:0 0 10px;
|
||||
}
|
||||
#panel_main p label{
|
||||
float: left;
|
||||
padding: 3px;
|
||||
width: 100px;
|
||||
}
|
||||
#panel_main .translation_missing{
|
||||
float: left;
|
||||
padding: 3px;
|
||||
width: 100px;
|
||||
|
||||
}
|
||||
.text{
|
||||
border: 1px solid #818181;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
font: 12px/100% helvetica,arial,sans-serif;
|
||||
padding: 3px;
|
||||
width: 205px;
|
||||
}
|
||||
|
||||
#site_info{
|
||||
background: none repeat scroll 0 0 #FFFFFF;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
box-shadow: 0 0 5px #000000;
|
||||
/* height: 289px;*/
|
||||
margin: 0 0 20px;
|
||||
overflow: hidden;
|
||||
width: 600px;
|
||||
}
|
||||
#siteinfo_title{
|
||||
background: none repeat scroll 0 0 #333333;
|
||||
color: #FFFFFF;
|
||||
font: 24px/50px arial,sans-serif;
|
||||
height: 50px;
|
||||
margin: 0;
|
||||
padding: 0 0 0 20px;
|
||||
text-shadow: 0 1px 0 #000000;
|
||||
}
|
||||
#siteinfo_tb{
|
||||
background: none repeat scroll 0 0 #FFFFFF;
|
||||
}
|
||||
#siteinfo_tb td{
|
||||
background: none repeat scroll 0 0 transparent;
|
||||
border-bottom: 1px solid #333333;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.buy_btn{
|
||||
float:left;
|
||||
margin: 0 10px 0 0;
|
||||
}
|
||||
.main table td .buy_btn a{
|
||||
background: url("/assets/buy_btn.png") no-repeat scroll 0 0 transparent;
|
||||
color: #000000;
|
||||
display: block;
|
||||
font-size: 22px;
|
||||
height: 37px;
|
||||
line-height: 37px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
text-shadow: 0 1px 0 #FFFFFF;
|
||||
width: 170px;
|
||||
padding: 0px;
|
||||
}
|
||||
.buy_btn a:hover{
|
||||
background-position:0 bottom;
|
||||
}
|
||||
.bought_btn{
|
||||
background: url("/assets/bought_btn.png") no-repeat scroll 0 0 transparent;
|
||||
color: #FFFFFF;
|
||||
float:left;
|
||||
font-size: 22px;
|
||||
height: 37px;
|
||||
line-height: 37px;
|
||||
margin: 0 10px 0 0;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #C06408;
|
||||
width: 170px;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
/*
|
||||
*This is a manifest file that'll automatically include all the stylesheets available in this directory
|
||||
*and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
||||
*the top of the compiled file, but it's generally better to create a new file per style scope.
|
||||
*= require_self
|
||||
|
||||
*/
|
|
@ -0,0 +1,230 @@
|
|||
|
||||
html, body{
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
html{
|
||||
background: url(<%= asset_path "body.jpg" %>) no-repeat scroll 0 0 transparent;
|
||||
background-size: cover;
|
||||
}
|
||||
body{
|
||||
color: #000000;
|
||||
font-family: helvetica,arial,sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#panel_banner_link{
|
||||
background: url(<%= asset_path "orbitbar1.png" %>) repeat-x scroll 0 0;
|
||||
height: 52px;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.hmenu{
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 1px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
|
||||
#orbit{
|
||||
background: url(<%= asset_path "bar_orbit.png" %>) no-repeat scroll 0 0 transparent;
|
||||
cursor:pointer;
|
||||
height: 43px;
|
||||
left: 10px;
|
||||
position: relative;
|
||||
width: 41px;
|
||||
}
|
||||
|
||||
#orbit:hover{
|
||||
background-position:0 -43px;
|
||||
box-shadow: 0 3px 3px #000000;
|
||||
}
|
||||
#orbit:hover #orblist{
|
||||
display:block;
|
||||
}
|
||||
#orblist{
|
||||
background: none repeat scroll 0 0 #FFFFFF;
|
||||
border-radius: 0 3px 3px 3px;
|
||||
box-shadow: 0 3px 3px #000000;
|
||||
display: none;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
position: absolute;
|
||||
top: 43px;
|
||||
width: 130px;
|
||||
z-index:10;
|
||||
}
|
||||
#orblist li{
|
||||
border-bottom:1px solid #aaa;
|
||||
list-style:none;
|
||||
}
|
||||
.orblink{
|
||||
color: #333333;
|
||||
display: block;
|
||||
font: 12px/100% arial,sans-serif;
|
||||
padding: 5px;
|
||||
text-decoration: none;
|
||||
}
|
||||
.orblink:hover{
|
||||
background:#eee;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
#log_out a{
|
||||
background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right 0 transparent;
|
||||
border: medium none !important;
|
||||
display: block !important;
|
||||
height: 40px !important;
|
||||
line-height: normal !important;
|
||||
padding: 0 !important;
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
text-indent: -10000px;
|
||||
top: 0px;
|
||||
width: 43px !important;
|
||||
}
|
||||
#log_out a:hover{
|
||||
background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right bottom transparent !important;
|
||||
}
|
||||
.lang{
|
||||
color: #FFFFFF;
|
||||
font-size: 15px;
|
||||
line-height: 40px;
|
||||
position: absolute;
|
||||
right: 55px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.lang a{
|
||||
color:#fff;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
.lang a:hover{
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
#panel_container{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#panel_container h1{
|
||||
font: 28px/100% helvetica,arial,sans-serif;
|
||||
margin: 0 0 20px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#panel_header{
|
||||
background: none repeat scroll 0 0 #F1F1F1;
|
||||
border-bottom: 1px solid #818181;
|
||||
padding: 10px;
|
||||
}
|
||||
#panel_header:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
#panel_header #panel_nav{
|
||||
margin:0;
|
||||
padding:0;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
#panel_header #panel_nav li{
|
||||
float: left;
|
||||
list-style: none outside none;
|
||||
}
|
||||
|
||||
#panel_header #panel_nav li a{
|
||||
background: none repeat scroll 0 0 #fff;
|
||||
border-radius: 13px 13px 13px 13px;
|
||||
border: 1px solid #D6D6D6;
|
||||
color: #000000;
|
||||
float: left;
|
||||
font-size:15px;
|
||||
margin: 0 20px 0 0;
|
||||
padding: 5px 10px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#panel_header #panel_nav li a:hover{
|
||||
background: none repeat scroll 0 0 #818181;
|
||||
border-radius: 13px 13px 13px 13px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#panel_content{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#panel_sidebar2{
|
||||
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.75);
|
||||
box-shadow: 3px 0 3px #000000;
|
||||
float: left;
|
||||
height: 100%;
|
||||
width: 16%;
|
||||
}
|
||||
#panel_sidebar{
|
||||
padding: 62px 0 0;
|
||||
}
|
||||
#panel_sidebar ul{
|
||||
background: none repeat scroll 0 0 #13547C;
|
||||
margin: 0;
|
||||
padding: 0 0 0 10px;
|
||||
}
|
||||
#panel_sidebar ul li{
|
||||
background: none repeat scroll 0 0 #13547C;
|
||||
border-top: 1px solid #145B87;
|
||||
color: #FFFFFF;
|
||||
font-size: 11px;
|
||||
line-height: 29px;
|
||||
list-style: none outside none;
|
||||
}
|
||||
#panel_sidebar li ul{
|
||||
}
|
||||
#panel_sidebar li ul ul{
|
||||
}
|
||||
#panel_sidebar a{
|
||||
color: #FFFFFF;
|
||||
font-size: 11px;
|
||||
text-decoration: none;
|
||||
}
|
||||
#panel_sidebar a:hover{}
|
||||
#panel_main2{
|
||||
background:#fff;
|
||||
float: left;
|
||||
height: 100%;
|
||||
padding: 0 1%;
|
||||
width: 82%;
|
||||
}
|
||||
#panel_main{
|
||||
padding: 62px 0 0;
|
||||
}
|
||||
|
||||
#panel_main p label{
|
||||
display: block;
|
||||
padding: 3px;
|
||||
}
|
||||
#panel_main .translation_missing{
|
||||
float: left;
|
||||
padding: 3px;
|
||||
width: 100px;
|
||||
|
||||
}
|
||||
.text{
|
||||
border: 1px solid #818181;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
font: 12px/100% helvetica,arial,sans-serif;
|
||||
padding: 3px;
|
||||
width: 205px;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
|
@ -0,0 +1,12 @@
|
|||
.z-preview * {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.z-preview {
|
||||
background: white;
|
||||
border: solid;
|
||||
position: absolute;
|
||||
width: 200px;
|
||||
float: right;
|
||||
height: 200px;
|
||||
}
|
|
@ -0,0 +1,507 @@
|
|||
/*
|
||||
*This is a manifest file that'll automatically include all the stylesheets available in this directory
|
||||
*and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
||||
*the top of the compiled file, but it's generally better to create a new file per style scope.
|
||||
*= require_self
|
||||
|
||||
*/
|
||||
a, a:hover {
|
||||
text-decoration: none;
|
||||
outline:none;
|
||||
}
|
||||
html,body {
|
||||
height:100%;
|
||||
margin:0;
|
||||
font-family: Helvetica, '微軟正黑體';
|
||||
overflow-x:hidden
|
||||
}
|
||||
ul {
|
||||
list-style:none;
|
||||
list-style-image:none;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
.info_input input{
|
||||
border:none;
|
||||
padding:5px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
input:focus, select:focus, textarea:focus {
|
||||
outline:none;
|
||||
-moz-outline-radius: 0;
|
||||
}
|
||||
.clear:after {
|
||||
content:".";
|
||||
clear:both;
|
||||
height:0;
|
||||
display:block;
|
||||
visibility:hidden;
|
||||
}
|
||||
#content{
|
||||
height:100%;
|
||||
}
|
||||
#sidebar {
|
||||
position:fixed;
|
||||
top:0;
|
||||
left:0;
|
||||
height: 100%;
|
||||
width:220px;
|
||||
/*background-color:rgba(245,245,245,1);*/
|
||||
background:url(<%= asset_path '75.png' %>) repeat left top;
|
||||
-moz-box-shadow: 3px 0px 4px #472a12; /* Firefox */
|
||||
-webkit-box-shadow: 3px 0px 4px #472a12;/* Safari 和 Chrome */
|
||||
box-shadow: 3px 0px 4px #472a12; /* Opera 10.5 + */
|
||||
}
|
||||
#search {
|
||||
background:url(<%= asset_path 'search_block_bg.jpg' %>) repeat-x left top;
|
||||
margin-top:43px;
|
||||
padding:15px 12px;
|
||||
height:20px;
|
||||
}
|
||||
#search input {
|
||||
background:url(<%= asset_path 'search_bg.png' %>) no-repeat left top;
|
||||
border:none;
|
||||
width:154px;
|
||||
height:20px;
|
||||
padding: 0 20px;
|
||||
font-family:Helvetica;
|
||||
}
|
||||
h1 {
|
||||
background:url(<%= asset_path 'h1_bg.png' %>) repeat-x left top;
|
||||
margin:0;
|
||||
line-height:21px;
|
||||
height:21px;
|
||||
font-size:12px;
|
||||
padding-left:10px;
|
||||
font-weight:normal;
|
||||
text-shadow:0px -1px 0px #000;
|
||||
color:#FFF;
|
||||
border-top:1px solid #424344;
|
||||
border-bottom:1px solid #1b1b1b;
|
||||
}
|
||||
#user_list .member_setup ul li.set_1 {
|
||||
background-position:left bottom;
|
||||
border-top:1px solid #406cc3;
|
||||
border-bottom:1px solid #242628;
|
||||
}
|
||||
#roles_list .member_setup ul li.set_2 {
|
||||
background-position:left bottom;
|
||||
border-top:1px solid #406cc3;
|
||||
border-bottom:1px solid #242628;
|
||||
}
|
||||
#infos_list .member_setup ul li.set_3 {
|
||||
background-position:left bottom;
|
||||
border-top:1px solid #406cc3;
|
||||
border-bottom:1px solid #242628;
|
||||
}
|
||||
#user_list .member_setup ul li.set_1 a span {
|
||||
background-position:left bottom;
|
||||
color:#eeeeee;
|
||||
}
|
||||
#roles_list .member_setup ul li.set_2 a span {
|
||||
background-position:left bottom;
|
||||
color:#eeeeee;
|
||||
}
|
||||
.member_setup ul {
|
||||
color:#fff;
|
||||
font-size:12px;
|
||||
background:url(<%= asset_path 'line.png' %>) repeat-x left bottom;
|
||||
}
|
||||
.member_setup ul li {
|
||||
background:url(<%= asset_path 'sidebar_li.jpg' %>) repeat-x left top;
|
||||
/* line-height:31px;*/
|
||||
border-top:1px solid #424344;
|
||||
border-bottom:1px solid #000000;
|
||||
}
|
||||
.member_setup ul li:hover {
|
||||
background-position:left bottom;
|
||||
border-top:1px solid #406cc3;
|
||||
border-bottom:1px solid #242628;
|
||||
}
|
||||
.member_setup ul li a {
|
||||
display: block;
|
||||
padding: 7px 0 6px 12px;
|
||||
color:#c4c4c4;
|
||||
}
|
||||
.member_setup ul li a span {
|
||||
background:url(<%= asset_path 'add_mamber.png' %>) left top no-repeat;
|
||||
text-shadow: 0px 1px 0px #000;
|
||||
line-height: 18px;
|
||||
padding: 2px 0 1px 35px;
|
||||
}
|
||||
.member_setup ul li a:hover span {
|
||||
background-position:left bottom;
|
||||
color:#eeeeee;
|
||||
}
|
||||
#main{
|
||||
position: relative;
|
||||
margin-left: 260px;
|
||||
padding-right: 40px;
|
||||
height:100%;
|
||||
}
|
||||
.main_list {
|
||||
padding-top:70px;
|
||||
}
|
||||
.main_list ul {
|
||||
clear:both;
|
||||
}
|
||||
.main_list li {
|
||||
background:url(<%= asset_path '75.png' %>) repeat left top;
|
||||
margin-bottom:20px;
|
||||
}
|
||||
.main_list li span {
|
||||
display:inline-block;
|
||||
float:left;
|
||||
padding-left:20px;
|
||||
color:#fff;
|
||||
font-size:14px;
|
||||
line-height:40px;
|
||||
width:18%;
|
||||
}
|
||||
.main_list li.list_head {
|
||||
background:none;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.main_list li.list_head span {
|
||||
font-size:16px;
|
||||
line-height:inherit;
|
||||
text-shadow: 0px 1px 1px #3e2914;
|
||||
}
|
||||
.main_list li.list_item {
|
||||
position:relative;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-box-shadow: 0px 0px 6px #291508; /* Firefox */
|
||||
-webkit-box-shadow: 0px 0px 6px #291508;/* Safari 和 Chrome */
|
||||
box-shadow: 0px 0px 6px #291508; /* Opera 10.5 + */
|
||||
}
|
||||
.main_list li.list_item:hover {
|
||||
border:1px solid #3699dd;
|
||||
}
|
||||
.main_list li.disable {
|
||||
opacity:0.6;
|
||||
}
|
||||
.main_list li.list_item:hover span {
|
||||
line-height:38px;
|
||||
}
|
||||
.main_list li .roles {
|
||||
}
|
||||
.main_list li .name {
|
||||
}
|
||||
.main_list li .email {
|
||||
}
|
||||
.main_list li .admin{
|
||||
}
|
||||
.main_list li .action{
|
||||
float: right;
|
||||
width:10%;
|
||||
}
|
||||
#main .action a{
|
||||
background-image:url(<%= asset_path 'icon.png' %>);
|
||||
text-indent:-9999px;
|
||||
display:inline-block;
|
||||
width:19px;
|
||||
height:19px;
|
||||
margin-top:8px;
|
||||
margin-right:10px;
|
||||
}
|
||||
#main .action a.show{
|
||||
background-position:left top;
|
||||
}
|
||||
#main .action a.edit{
|
||||
background-position:-19px top;
|
||||
}
|
||||
#main .action a.delete{
|
||||
background-position:-38px top;
|
||||
}
|
||||
#main a.switch{
|
||||
background:url(<%= asset_path 'switch.png' %>) no-repeat left 3px;
|
||||
width:40px;
|
||||
}
|
||||
#main .disable a.switch{
|
||||
background:url(<%= asset_path 'switch.png' %>) no-repeat left bottom;
|
||||
}
|
||||
#main .action a.show:hover{
|
||||
background-position:left -19px;
|
||||
}
|
||||
#main .action a.edit:hover{
|
||||
background-position:-19px -19px;
|
||||
}
|
||||
#main .action a.delete:hover{
|
||||
background-position:-38px -19px;
|
||||
}
|
||||
#main .list_item .roles {
|
||||
background-image:url(<%= asset_path 'roles_type.jpg' %>);
|
||||
background-repeat:repeat-x;
|
||||
border-radius: 5px 0 0 5px;
|
||||
-moz-border-radius: 5px 0 0 5px;
|
||||
-webkit-border-radius: 5px 0 0 5px;
|
||||
}
|
||||
#roles_list .roles_block .action a{
|
||||
margin-top:0;
|
||||
margin-right:0;
|
||||
}
|
||||
.student {
|
||||
background-position:0 -5px;
|
||||
}
|
||||
.teacher {
|
||||
background-position:0 -54px;
|
||||
}
|
||||
#add_new a {
|
||||
background-position:-54px -17px;
|
||||
}
|
||||
#add_new a:hover {
|
||||
background-position: -54px 3px;
|
||||
}
|
||||
.buttom {
|
||||
float:right;
|
||||
}
|
||||
#confirm a{
|
||||
background-position:4px -70px;
|
||||
}
|
||||
#confirm a:hover{
|
||||
background-position: 4px -51px;
|
||||
}
|
||||
#create a{
|
||||
background-image: none;
|
||||
padding: 0 10px;
|
||||
}
|
||||
#update a{
|
||||
background-position:4px -112px;
|
||||
}
|
||||
#update a:hover{
|
||||
background-position:4px -89px;
|
||||
}
|
||||
#back a{
|
||||
background-position:4px -156px;
|
||||
}
|
||||
#back a:hover{
|
||||
background-position:4px -133px;
|
||||
}
|
||||
.buttom a {
|
||||
margin:0 0 20px 10px;
|
||||
background-image:url(<%= asset_path 'icon.png' %>);
|
||||
background-repeat:no-repeat;
|
||||
font-size:12px;
|
||||
color:#FFF;
|
||||
display:inline-block;
|
||||
padding:0 10px 0 25px;
|
||||
background-color: rgba(0, 0, 0, 0.75);
|
||||
line-height:24px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-box-shadow: 3px 0px 4px #180902; /* Firefox */
|
||||
-webkit-box-shadow: 3px 0px 4px #180902;/* Safari 和 Chrome */
|
||||
box-shadow: 3px 0px 4px #180902; /* Opera 10.5 + */
|
||||
}
|
||||
.buttom a:hover {
|
||||
color:#000;
|
||||
font-weight:bold;
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
#porfile{
|
||||
padding-top:100px;
|
||||
}
|
||||
#porfile h2 {
|
||||
color: #FFFFFF;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-shadow: 0 3px 2px #000000;
|
||||
position:absolute;
|
||||
top:-30px;
|
||||
}
|
||||
#porfile .user_mail {
|
||||
text-align: center;
|
||||
background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top;
|
||||
border:none;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
padding:3px 10px 1px;
|
||||
margin-top:10px;
|
||||
width:110px;
|
||||
height: 21px;
|
||||
font-size: 12px;
|
||||
color:#666666;
|
||||
text-shadow: 0 1px 0 #FFFFFF;
|
||||
}
|
||||
#porfile label {
|
||||
display:block;
|
||||
text-shadow: 0 1px 0 #FFFFFF;
|
||||
background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top;
|
||||
height: 25px;
|
||||
width:110px;
|
||||
padding: 0 0 0 18px;
|
||||
border:1px solid #d8d8d8;
|
||||
margin-top:10px;
|
||||
color:#666666;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
#porfile label:hover{
|
||||
background-position:left bottom;
|
||||
color:#000;
|
||||
border:1px solid #a6a6a6;
|
||||
}
|
||||
#porfile label input {
|
||||
border:none;
|
||||
margin: 6px 15px 0 0;
|
||||
float:left;
|
||||
}
|
||||
#porfile label span {
|
||||
display:block;
|
||||
float:left;
|
||||
line-height:27px;
|
||||
font-size:12px;
|
||||
}
|
||||
.roles_block {
|
||||
min-width:710px;
|
||||
margin-bottom:50px;
|
||||
position:relative;
|
||||
padding-bottom: 20px;
|
||||
background:url(<%= asset_path '75.png' %>) repeat left top;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-box-shadow: 0px 0px 4px #180902; /* Firefox */
|
||||
-webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */
|
||||
box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */
|
||||
}
|
||||
#user_list .roles_block {
|
||||
margin-left:180px;
|
||||
}
|
||||
#person {
|
||||
text-align:center;
|
||||
left: 265px;
|
||||
position: fixed;
|
||||
top: 75px;
|
||||
}
|
||||
#person img {
|
||||
background-color:#FFF;
|
||||
padding:5px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-box-shadow: 0px 0px 4px #180902; /* Firefox */
|
||||
-webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */
|
||||
box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */
|
||||
}
|
||||
#person .mail {
|
||||
color: #FFFFFF;
|
||||
font-size: 12px;
|
||||
text-shadow:0px 1px 0px #333;
|
||||
font-weight:bold;
|
||||
background:url(<%= asset_path 'line.png' %>) repeat-x left top;
|
||||
padding-top:10px;
|
||||
}
|
||||
#upload, #edit{
|
||||
margin: 0 auto;
|
||||
display:block;
|
||||
text-shadow: 0 1px 0 #FFFFFF;
|
||||
background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top;
|
||||
height: 25px;
|
||||
line-height:27px;
|
||||
color:#666666;
|
||||
width:128px;
|
||||
text-align:center;
|
||||
font-size:12px;
|
||||
border:1px solid #d8d8d8;
|
||||
margin-top:10px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
#upload:hover{
|
||||
background-position:left bottom;
|
||||
color:#000;
|
||||
border:1px solid #a6a6a6;
|
||||
}
|
||||
#main hr{
|
||||
height:8px;
|
||||
border:none;
|
||||
margin:0;
|
||||
border-radius: 5px 5px 0px 0px;
|
||||
-moz-border-radius: 5px 5px 0px 0px;
|
||||
-webkit-border-radius: 5px 5px 0px 0px;
|
||||
border-bottom:1px solid #000;
|
||||
}
|
||||
#basic_block hr{
|
||||
background-color:#666666;
|
||||
}
|
||||
#teacher_block hr{
|
||||
background-color:#0071a9;
|
||||
}
|
||||
#student_block hr{
|
||||
background-color:#af0045;
|
||||
}
|
||||
.info_input {
|
||||
padding:10px 20px;
|
||||
}
|
||||
.info_input table {
|
||||
color:#fff;
|
||||
width:100%;
|
||||
font-size:14px;
|
||||
}
|
||||
.info_input table td {
|
||||
padding:5px 10px 5px 0;
|
||||
width: 10%;
|
||||
}
|
||||
.info_input .list_head {
|
||||
background:url(<%= asset_path 'line.png' %>) left bottom repeat-x;
|
||||
}
|
||||
.info_input .list_head td {
|
||||
}
|
||||
.info_input .list_item {
|
||||
color:#AEAEAE;
|
||||
}
|
||||
.info_input .add {
|
||||
display:block;
|
||||
padding-left:22px;
|
||||
font-size:12px;
|
||||
line-height:21px;
|
||||
height:19px;
|
||||
background:url(<%= asset_path 'icon.png' %>) no-repeat -59px 0;
|
||||
margin-top: 10px;
|
||||
color: #DDDDDD;
|
||||
}
|
||||
.info_input .add:hover {
|
||||
color:#FFF;
|
||||
background-position:-59px -19px;
|
||||
}
|
||||
.info_input li {
|
||||
height:30px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.info_input li span {
|
||||
display:inline-block;
|
||||
float:left;
|
||||
color:#fff;
|
||||
font-size:14px;
|
||||
line-height:30px;
|
||||
margin-right:10px;
|
||||
}
|
||||
#user_list .info_input li span {
|
||||
width: 25%;
|
||||
}
|
||||
#roles_list .info_input li span {
|
||||
width:15%;
|
||||
}
|
||||
.info_input li span:last-child {
|
||||
}
|
||||
#person select {
|
||||
background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top;
|
||||
border:1px solid #d8d8d8;
|
||||
margin-top: 10px;
|
||||
width: 130px;
|
||||
padding:3px 6px 3px 14px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border:none;
|
||||
}
|
|
@ -0,0 +1,305 @@
|
|||
body{
|
||||
background:url(<%= asset_path 'wood_floor.jpg' %>) fixed center 0;
|
||||
/*background:url(images/jobs.jpg) fixed center bottom;*/
|
||||
-moz-background-size:cover;
|
||||
background-size:cover;
|
||||
color: #000000;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#hmenu{
|
||||
background:url(<%= asset_path 'orbitbar1.png' %>) repeat-x 0 0;
|
||||
height: 50px;
|
||||
position:fixed;
|
||||
top:0;
|
||||
left:0;
|
||||
width:100%;
|
||||
z-index: 5;
|
||||
}
|
||||
#orbit_icon {
|
||||
margin-left: 10px;
|
||||
}
|
||||
#orbit_icon a {
|
||||
background:url(<%= asset_path 'bar_orbit.png' %>) no-repeat scroll left top transparent;
|
||||
height: 43px;
|
||||
width: 41px;
|
||||
display:block;
|
||||
text-indent:-9999px;
|
||||
}
|
||||
#orbit_icon a:hover {
|
||||
background:url(<%= asset_path 'bar_orbit.png' %>) no-repeat scroll left 50% transparent;
|
||||
}
|
||||
#hmenu #left{
|
||||
left: 51px;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
}
|
||||
#hmenu #left a{
|
||||
border-left: 1px solid #000000;
|
||||
border-right: 1px solid #7F8488;
|
||||
color: #FFFFFF;
|
||||
display: block;
|
||||
font-size: 17px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding: 0 10px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
}
|
||||
#hmenu #left a:hover{
|
||||
background:#000;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
#hmenu #right{
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 1px;
|
||||
width: 393px;
|
||||
}
|
||||
#hmenu #right a{
|
||||
border-left: 1px solid #7F8488;
|
||||
border-right: 1px solid #7F8488;
|
||||
color: #FFFFFF;
|
||||
display: block;
|
||||
font-size: 17px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding: 0 10px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
width: 65px;
|
||||
}
|
||||
#hmenu #right a:hover{
|
||||
background:#000;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
#hmenu form{
|
||||
left: 27px;
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
}
|
||||
#login_id{
|
||||
background:url(<%= asset_path 'bar_id.png' %>) no-repeat scroll 0 0 transparent;
|
||||
border: medium none;
|
||||
color: #818181;
|
||||
font-family: arial,sans-serif;
|
||||
height: 26px;
|
||||
left: 70px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 119px;
|
||||
}
|
||||
#login_id input {
|
||||
background: none repeat scroll 0 0 transparent;
|
||||
border: medium none;
|
||||
font-family: arial,sans-serif;
|
||||
height: 15px;
|
||||
left: 21px;
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
width: 92px;
|
||||
}
|
||||
|
||||
#login_pw {
|
||||
background:url(<%= asset_path 'bar_pw.png' %>) no-repeat scroll 0 0 transparent;
|
||||
border: medium none;
|
||||
color: #818181;
|
||||
font-family: arial,sans-serif;
|
||||
height: 26px;
|
||||
left: 193px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 119px;
|
||||
}
|
||||
|
||||
#login_pw input {
|
||||
background: none repeat scroll 0 0 transparent;
|
||||
border: medium none;
|
||||
font-family: arial,sans-serif;
|
||||
height: 15px;
|
||||
left: 21px;
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
width: 92px;
|
||||
}
|
||||
#login_btn input {
|
||||
background:url(<%= asset_path 'bar_btn.png' %>) no-repeat scroll 0 0 transparent;
|
||||
border: medium none;
|
||||
color: #FFFFFF;
|
||||
cursor: pointer;
|
||||
font-family: arial,sans-serif;
|
||||
height: 26px;
|
||||
left: 316px;
|
||||
margin: 0;
|
||||
padding: 0 0 2px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
#log_out a{
|
||||
background:url(<%= asset_path 'service_btn.png' %>) no-repeat scroll right 0 transparent;
|
||||
border: medium none !important;
|
||||
display: block !important;
|
||||
height: 40px !important;
|
||||
line-height: normal !important;
|
||||
padding: 0 !important;
|
||||
position: absolute;
|
||||
/* right: -9px;*/
|
||||
text-indent: -10000px;
|
||||
top: 0px;
|
||||
width: 43px !important;
|
||||
}
|
||||
#log_out a:hover{
|
||||
background:url(<%= asset_path 'service_btn.png' %>) no-repeat scroll right bottom transparent !important;
|
||||
}
|
||||
|
||||
#hmenu #right select{
|
||||
font-family: helvetica,arial,sans-serif;
|
||||
left: 97px;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
width: 120px;
|
||||
}
|
||||
.content{
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#user_info{
|
||||
background: none repeat scroll 0 0 #FEFEFE;
|
||||
border: 1px solid #818181;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
margin: 0 0 20px;
|
||||
padding: 10px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
#user_info table{
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
#user_info table td{
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
#sites_info{
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(white), to(#F8F8F8));
|
||||
border: 1px solid #818181;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
float: left;
|
||||
margin: 0 20px 20px 0;
|
||||
width: 30%;
|
||||
min-width: 320px;
|
||||
}
|
||||
#sites_info h3{
|
||||
background: none repeat scroll 0 0 #EEEEEE;
|
||||
border: 1px solid #DDDDDD;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
font: 24px/100% helvetica,arial,sans-serif;
|
||||
margin: 2% 2% 0;
|
||||
padding: 1%;
|
||||
}
|
||||
#sites_info table{
|
||||
background: none repeat scroll 0 0 #fff;
|
||||
border: 1px solid #DDDDDD;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
margin: 2%;
|
||||
width: 96%;
|
||||
}
|
||||
#sites_info table td{
|
||||
padding: 10px 5px;
|
||||
}
|
||||
#sites_info table th{
|
||||
border-right: 1px solid #DDDDDD;
|
||||
color: #808080;
|
||||
font-size: 18px;
|
||||
font-weight: normal;
|
||||
padding: 10px 5px;
|
||||
text-align: right;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
|
||||
#purchases{
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(white), to(#F8F8F8));
|
||||
border: 1px solid #818181;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
float: left;
|
||||
width: 30%;
|
||||
min-width: 320px;
|
||||
}
|
||||
#purchases h3{
|
||||
background: none repeat scroll 0 0 #EEEEEE;
|
||||
border: 1px solid #DDDDDD;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
font: 24px/100% helvetica,arial,sans-serif;
|
||||
margin: 2% 2% 0;
|
||||
padding: 1%;
|
||||
}
|
||||
#purchases table{
|
||||
background: none repeat scroll 0 0 #fff;
|
||||
border: 1px solid #DDDDDD;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
margin: 2%;
|
||||
width: 96%;
|
||||
}
|
||||
#purchases table th{
|
||||
border-right: 1px solid #DDDDDD;
|
||||
color: #808080;
|
||||
font-size: 18px;
|
||||
font-weight: normal;
|
||||
padding: 10px 5px;
|
||||
text-align: right;
|
||||
width: 20%;
|
||||
}
|
||||
#purchases table td{
|
||||
padding: 10px 5px;
|
||||
}
|
||||
.design_page{
|
||||
}
|
||||
.style_list{
|
||||
background:url(<%= asset_path 'preview.png' %>) no-repeat 0 0;
|
||||
height:246px;
|
||||
margin: 20px 0;
|
||||
padding: 0 0 0 236px;
|
||||
}
|
||||
.style_list ul{
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
.style_list li{
|
||||
color: #EDA330;
|
||||
font-size: 20px;
|
||||
list-style: none outside none;
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
.list_title{
|
||||
color: #818181;
|
||||
display: block;
|
||||
font: 24px/100% ·L³n¥¿¶ÂÅé,sans-serif;
|
||||
}
|
||||
.buy_btn a{
|
||||
background:url(<%= asset_path "buy_btn.png" %>) no-repeat scroll 0 0 transparent;
|
||||
color: #000000;
|
||||
display: block;
|
||||
font-size: 22px;
|
||||
height: 37px;
|
||||
line-height: 37px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
text-shadow: 0 1px 0 #FFFFFF;
|
||||
width: 170px;
|
||||
}
|
||||
.buy_btn a:hover{
|
||||
background-position:0 bottom;
|
||||
}
|
||||
.bought_btn{
|
||||
background:url(<%= asset_path "bought_btn.png" %>) no-repeat scroll 0 0 transparent;
|
||||
color: #FFFFFF;
|
||||
font-size: 22px;
|
||||
height: 37px;
|
||||
line-height: 37px;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #C06408;
|
||||
width: 170px;
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
class Admin::DesignsController < ApplicationController
|
||||
require "net/http"
|
||||
require "uri"
|
||||
require 'zip/zip'
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
|
||||
def upload_package
|
||||
if !params[:design].nil?
|
||||
temp_file = Tempfile.new("temp_file")
|
||||
original_file = params[:design][:package_file]
|
||||
#if original_file.content_type == 'application/zip'
|
||||
temp_file.write(original_file.read.force_encoding('UTF-8'))
|
||||
temp_file.rewind
|
||||
filename = File.basename(original_file.original_filename,".zip")
|
||||
unzip_design(temp_file, filename)
|
||||
#else
|
||||
# flash[:error] = "Upload file should be in zip format"
|
||||
#end
|
||||
temp_file.close
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
@designs = Design.all.entries
|
||||
end
|
||||
|
||||
def new
|
||||
@design = Design.new
|
||||
end
|
||||
|
||||
def update
|
||||
@design = Design.find(params[:id])
|
||||
if @design.update_attributes(params[:design])
|
||||
flash[:notice] = "Successfully updated design and tasks."
|
||||
redirect_to admin_designs_url(@design)
|
||||
else
|
||||
render :action => 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
def edit_file
|
||||
@design = Design.find(params[:id])
|
||||
filename = params[:filename]
|
||||
files = @design.themes + @design.javascripts + @design.images
|
||||
file_to_removed = files.find{ |obj|
|
||||
obj.file_filename == filename
|
||||
}
|
||||
type = file_to_removed._type
|
||||
new_file = ""
|
||||
Dir.mktmpdir('design_temp'){ |dir|
|
||||
temp_file = File.new(dir+'/'+filename,'w+')
|
||||
temp_file.write params[:context]
|
||||
replace_target = eval("@design.#{type.downcase.pluralize}")
|
||||
new_file = replace_target.build(:file => temp_file,:to_save=>true)
|
||||
file_to_removed.destroy
|
||||
new_file.save
|
||||
temp_file.close
|
||||
}
|
||||
respond_to do |format|
|
||||
format.js {}
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@design = Design.find(params[:id])
|
||||
end
|
||||
|
||||
def destroy
|
||||
@design = Design.find(params[:id])
|
||||
@design.destroy
|
||||
redirect_to admin_designs_url
|
||||
end
|
||||
|
||||
def create
|
||||
@design = Design.new(params[:design])
|
||||
if @design.save
|
||||
flash[:notice] = "Successfully created design and tasks."
|
||||
redirect_to admin_designs_url
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def unzip_design(file, zip_name)
|
||||
Zip::ZipFile.open(file) { |zip_file|
|
||||
design = Design.new.from_json(zip_file.read("#{zip_name}/info.json"))
|
||||
Dir.mktmpdir('f_path') { |dir|
|
||||
design.build_layout
|
||||
themes_entries = []
|
||||
javascripts_entries = []
|
||||
images_entries = []
|
||||
|
||||
zip_file.entries.each do |entry|
|
||||
case (path = entry.to_s)
|
||||
when /\A(#{zip_name})\/(default\.css)\z/ #for default css
|
||||
filename = File.basename(entry.to_s)
|
||||
temp_file = File.new(dir + '/' + filename, 'w+')
|
||||
temp_file.write (zip_file.read entry ).force_encoding('UTF-8')
|
||||
default_css = design.build_default_css
|
||||
default_css.file = temp_file
|
||||
default_css.file_filename = filename
|
||||
default_css.to_save = true
|
||||
when /\A(#{zip_name})\/(reset\.css)\z/ #for reset css
|
||||
filename = File.basename(entry.to_s)
|
||||
temp_file = File.new(dir + '/' + filename, 'w+')
|
||||
temp_file.write (zip_file.read entry ).force_encoding('UTF-8')
|
||||
reset_css = design.build_reset_css
|
||||
reset_css.file = temp_file
|
||||
reset_css.file_filename = filename
|
||||
reset_css.to_save = true
|
||||
when /\A(#{zip_name})\/(layout\.html)\z/ #for layout html
|
||||
filename = File.basename(entry.to_s)
|
||||
temp_file = File.new(dir + '/' + filename, 'w+')
|
||||
temp_file.write (zip_file.read entry ).force_encoding('UTF-8')
|
||||
design.layout.file = temp_file
|
||||
design.layout.to_save=true
|
||||
when /\A(#{zip_name})\/(themes)\/.*(\.css)\z/ #for themes css
|
||||
themes_entries << entry
|
||||
when /\A(#{zip_name})\/(javascripts)\/.*(\.js)\z/ #for js
|
||||
javascripts_entries << entry
|
||||
when /\A(#{zip_name})\/(images)\/.*((\.jpg)|(\.png)|(\.gif))\z/ #for img
|
||||
images_entries << entry
|
||||
end
|
||||
end
|
||||
|
||||
['themes', 'javascripts', 'images'].each do |type|
|
||||
eval("#{type}_entries").each do |entry|
|
||||
filename = File.basename entry.to_s
|
||||
temp_file = File.new(dir + '/' + filename, 'w+')
|
||||
temp_file.write (zip_file.read entry).force_encoding('UTF-8')
|
||||
build_and_store = eval("design.#{type}").build
|
||||
build_and_store.file = temp_file
|
||||
build_and_store.file_filename = filename
|
||||
build_and_store.to_save = true
|
||||
end
|
||||
end
|
||||
}
|
||||
design.save
|
||||
}
|
||||
end
|
||||
|
||||
end
|
|
@ -12,7 +12,7 @@ class Admin::ItemsController < ApplicationController
|
|||
if params[:item_id]
|
||||
@item = Item.find(params[:item_id])
|
||||
else
|
||||
@item = Item.first(:conditions => {:parent_id => nil})
|
||||
@item = get_homepage
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
class Admin::LayoutsController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
|
||||
def index
|
||||
@layouts = Layout.all.entries
|
||||
end
|
||||
|
||||
def show
|
||||
#TODO
|
||||
# @layout = Layout.find(params[:id])
|
||||
# redirect_to "/#{@layout.name}"
|
||||
end
|
||||
|
||||
def new
|
||||
@layout = Layout.new
|
||||
end
|
||||
|
||||
def edit
|
||||
@layout = Layout.find(params[:id])
|
||||
end
|
||||
|
||||
def create
|
||||
@layout = Layout.new(params[:layout])
|
||||
|
||||
if @layout.save
|
||||
flash[:notice] = t('admin.create_success_layout')
|
||||
redirect_to admin_layouts_url
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@layout = Layout.find(params[:id])
|
||||
|
||||
if @layout.update_attributes(params[:layout])
|
||||
flash[:notice] = t('admin.update_success_layout')
|
||||
redirect_to admin_layouts_url
|
||||
else
|
||||
render :action => "edit"
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@layout = Layout.find(params[:id])
|
||||
@layout.destroy
|
||||
|
||||
redirect_to admin_layouts_url
|
||||
end
|
||||
|
||||
end
|
|
@ -28,6 +28,7 @@ class Admin::PagePartsController < ApplicationController
|
|||
@partial = 'edit_text'
|
||||
@part_locale = params[:part_locale] || I18n.locale.to_s
|
||||
when 'module'
|
||||
@plugins=[{:module=>"Blog",:widgets=>[{:name=>"Blog",:path=>"panel/blog/widget_latest_post"},{:name=>"Blog",:path=>"panel/blog/widget_index"}]}]
|
||||
when 'snippet'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,14 +21,15 @@ class Admin::PagesController < ApplicationController
|
|||
@item = Page.new
|
||||
@item.is_published = true
|
||||
@item.parent_id = @parent_item.id rescue nil
|
||||
@designs = Design.all.entries
|
||||
@default_design = Design.first
|
||||
end
|
||||
|
||||
def edit
|
||||
@item = Page.find(params[:id])
|
||||
# @item.content = parse_content(@item.content, {:locale => 'show'})
|
||||
@item.content = parse_page_code(@item)
|
||||
@i18n_variable = @item.i18n_variable
|
||||
@code = params[:code]
|
||||
@designs = Design.all.entries
|
||||
@design = @item.design
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -52,8 +53,7 @@ class Admin::PagesController < ApplicationController
|
|||
|
||||
def update
|
||||
@item = Page.find(params[:id])
|
||||
parse_content_update_code(@item, params[:page][:content])
|
||||
if @item.update_attributes(params[:item])
|
||||
if @item.update_attributes(params[:page])
|
||||
flash[:notice] = t('admin.update_success_page')
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
|
@ -86,4 +86,12 @@ class Admin::PagesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def reload_themes
|
||||
@design = Design.find(params[:id])
|
||||
@themes = @design.themes
|
||||
respond_to do |format|
|
||||
format.js {}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,186 @@
|
|||
class Admin::PurchasesController < ApplicationController
|
||||
require "net/http"
|
||||
require "uri"
|
||||
require 'zip/zip'
|
||||
|
||||
layout "admin"
|
||||
|
||||
def index
|
||||
@purchases = Purchase.all.entries
|
||||
end
|
||||
|
||||
def download
|
||||
@purchase = Purchase.first(:conditions => {:id => params[:id]})
|
||||
download_purchase(@purchase, request.env['REQUEST_URI'].split('admin')[0].chop)
|
||||
@purchase.downloaded = true
|
||||
@purchase.save
|
||||
redirect_to admin_purchases_url
|
||||
end
|
||||
|
||||
def install_app
|
||||
unzip_app
|
||||
redirect_to admin_purchases_url
|
||||
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def download_purchase(purchase, url)
|
||||
uri = URI.parse("http://#{APP_CONFIG['store_ip']}/download/purchase")
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
request = Net::HTTP::Post.new(uri.request_uri)
|
||||
|
||||
public_key = OpenSSL::PKey::RSA.new(File.read(APP_CONFIG['main_public_key']))
|
||||
encrypted_data = public_key.public_encrypt({:purchase_id => purchase.purchase_id,
|
||||
:purchase_type => purchase._type,
|
||||
:roaming_id => Site.find(session[:site]).roaming_id,
|
||||
:url => url}.to_json)
|
||||
|
||||
request.set_form_data({ :purchase => encrypted_data})
|
||||
response = http.request(request)
|
||||
temp_file = Tempfile.new("temp_file")
|
||||
temp_file.binmode
|
||||
temp_file.write response.body
|
||||
temp_file.rewind
|
||||
zip_name = response['content-disposition'].split('filename=')[1].gsub(/[\\\"]|.zip/, '') rescue ''
|
||||
case purchase._type
|
||||
when 'Pdesign'
|
||||
unzip_design(temp_file, zip_name)
|
||||
when 'PModuleApp'
|
||||
unzip_module_app(temp_file, zip_name)
|
||||
end
|
||||
temp_file.close
|
||||
temp_file.unlink
|
||||
end
|
||||
|
||||
def unzip_design(file, zip_name)
|
||||
Zip::ZipFile.open(file) do |zip_file|
|
||||
encrypted = {}
|
||||
['encrypted_data', 'encrypted_key', 'encrypted_iv'].each do |e|
|
||||
encrypted.merge!(e => zip_file.read(e))
|
||||
end
|
||||
orig_file = decrypt_data(encrypted['encrypted_data'], encrypted['encrypted_key'], encrypted['encrypted_iv'])
|
||||
|
||||
temp_file = Tempfile.new("temp_file_zip")
|
||||
temp_file.binmode
|
||||
temp_file.write orig_file
|
||||
temp_file.rewind
|
||||
|
||||
Zip::ZipFile.open(temp_file) { |orig_zip|
|
||||
design = Design.new.from_json(orig_zip.read("#{zip_name}/#{zip_name}.json"))
|
||||
Dir.mktmpdir('f_path') { |dir|
|
||||
|
||||
build_file(orig_zip, zip_name, dir, design.layout) if design.layout
|
||||
build_file(orig_zip, zip_name, dir, design.default_css) if design.default_css
|
||||
build_file(orig_zip, zip_name, dir, design.reset_css) if design.reset_css
|
||||
|
||||
['themes', 'javascripts', 'images'].each do |type|
|
||||
design.send(type).each do |object|
|
||||
build_file(orig_zip, zip_name, dir, object, type)
|
||||
end
|
||||
end
|
||||
}
|
||||
temp_file.close
|
||||
temp_file.unlink
|
||||
design.save
|
||||
}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def unzip_app
|
||||
zip_name = "NewBlog"
|
||||
file = "#{Rails.root}/lib/NewBlog.zip"
|
||||
destination = "#{Rails.root}/vendor/plugins"
|
||||
|
||||
Zip::ZipFile.open(file) do |zip_file|
|
||||
orig_file = file
|
||||
|
||||
temp_file = Tempfile.new("temp_file_zip")
|
||||
temp_file.binmode
|
||||
temp_file.write orig_file
|
||||
temp_file.rewind
|
||||
|
||||
app = AppModule.new.from_json(zip_file.read("#{zip_name}/#{zip_name}/#{zip_name}.json"))
|
||||
zip_file.each do |f|
|
||||
if (f.to_s=~/^#{zip_name}\/#{zip_name}\/*/)
|
||||
f_path=File.join(destination, f.name.gsub(/^#{zip_name}\//, ''))
|
||||
FileUtils.mkdir_p(File.dirname(f_path))
|
||||
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
||||
end
|
||||
end
|
||||
|
||||
log = Logger.new(STDOUT)
|
||||
log.level = Logger::WARN
|
||||
log.warn("App unzip procress is finished,please restart the server to apply effect")
|
||||
|
||||
#TODO Perform touch tmp/restart to restart in production env
|
||||
end
|
||||
end
|
||||
|
||||
def unzip_module_app(file, zip_name)
|
||||
destination = "#{Rails.root}/vendor/plugins"
|
||||
Zip::ZipFile.open(file) do |zip_file|
|
||||
encrypted = {}
|
||||
['encrypted_data', 'encrypted_key', 'encrypted_iv'].each do |e|
|
||||
encrypted.merge!(e => zip_file.read(e))
|
||||
end
|
||||
orig_file = decrypt_data(encrypted['encrypted_data'], encrypted['encrypted_key'], encrypted['encrypted_iv'])
|
||||
|
||||
temp_file = Tempfile.new("temp_file_zip")
|
||||
temp_file.binmode
|
||||
temp_file.write orig_file
|
||||
temp_file.rewind
|
||||
|
||||
Zip::ZipFile.open(temp_file) { |orig_zip|
|
||||
module_app = ModuleApp.new.from_json(orig_zip.read("#{zip_name}/#{zip_name}.json"))
|
||||
orig_zip.remove("#{zip_name}/#{zip_name}.json")
|
||||
|
||||
orig_zip.each do |orig|
|
||||
inner_temp_file = Tempfile.new("inner_temp_file_zip")
|
||||
inner_temp_file.binmode
|
||||
inner_temp_file.write orig_zip.read(orig)
|
||||
inner_temp_file.rewind
|
||||
|
||||
Zip::ZipFile.open(inner_temp_file) {|inner_zip|
|
||||
inner_zip.each do |f|
|
||||
if (f.to_s=~/^#{zip_name}\/*/)
|
||||
f_path = File.join(destination, f.name)
|
||||
FileUtils.mkdir_p(File.dirname(f_path))
|
||||
inner_zip.extract(f, f_path) unless File.exist?(f_path)
|
||||
end
|
||||
end
|
||||
}
|
||||
inner_temp_file.close
|
||||
inner_temp_file.unlink
|
||||
end
|
||||
|
||||
module_app.save
|
||||
|
||||
log = Logger.new(STDOUT)
|
||||
log.level = Logger::WARN
|
||||
log.warn("App unzip procress is finished,please restart the server to apply effect")
|
||||
}
|
||||
|
||||
temp_file.close
|
||||
temp_file.unlink
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
def build_file(orig_zip, zip_name, dir, object, type = nil)
|
||||
title = object.file_filename
|
||||
temp = File.new(dir + '/' + title, 'w+')
|
||||
temp.write orig_zip.read(zip_name + '/' + (type ? (type + '/') : '') + title)
|
||||
object.file = temp
|
||||
object.to_save = true
|
||||
end
|
||||
|
||||
def unzip_file (file, destination)
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
class Admin::SitesController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
|
||||
def index
|
||||
@site = Site.first
|
||||
redirect_to :action => :new unless @site
|
||||
end
|
||||
|
||||
def new
|
||||
@site = Site.new
|
||||
end
|
||||
|
||||
end
|
|
@ -5,6 +5,8 @@ class Admin::SnippetsController < ApplicationController
|
|||
before_filter :find_parent_item
|
||||
before_filter :is_admin?
|
||||
|
||||
#Snippet is a object admin user can define his own tag and being used later on in parser
|
||||
|
||||
def show
|
||||
#TODO
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class Admin::UserAttributesController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
layout "member"
|
||||
before_filter :authenticate_user!
|
||||
|
||||
def index
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class Admin::UserInfoModelsController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
layout "member"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class Admin::UserRoleModelsController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
layout "member"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class Panel::UsersController < ApplicationController
|
||||
class Admin::UsersController < ApplicationController
|
||||
|
||||
layout "panel"
|
||||
layout "member"
|
||||
before_filter :authenticate_user!
|
||||
|
||||
def index
|
||||
|
@ -28,7 +28,7 @@ class Panel::UsersController < ApplicationController
|
|||
user_role.save
|
||||
user_role.attribute_values.each(&:save)
|
||||
end
|
||||
flash[:notice] = t('panel.create_success_user')
|
||||
flash[:notice] = t('admin.create_success_user')
|
||||
redirect_to :action => :index
|
||||
else
|
||||
render :action => :new
|
||||
|
@ -48,10 +48,10 @@ class Panel::UsersController < ApplicationController
|
|||
@user.avatar = params[:file] if params[:file]
|
||||
|
||||
if @user.id.to_s.eql?(session['warden.user.user.key'][1].to_s) && @user.admin != params[:user][:admin].to_i.to_b
|
||||
flash.now[:error] = t('panel.cant_revoke_self_admin')
|
||||
flash.now[:error] = t('admin.cant_revoke_self_admin')
|
||||
end
|
||||
if !flash[:error] && @user.update_attributes(params[:user])
|
||||
flash[:notice] = t('panel.update_success_user')
|
||||
flash[:notice] = t('admin.update_success_user')
|
||||
redirect_to :action => :index
|
||||
else
|
||||
get_info_role_models
|
||||
|
@ -61,7 +61,7 @@ class Panel::UsersController < ApplicationController
|
|||
|
||||
def destroy
|
||||
if params[:id].eql?(session['warden.user.user.key'][1].to_s)
|
||||
flash[:error] = t('panel.cant_delete_self')
|
||||
flash[:error] = t('admin.cant_delete_self')
|
||||
else
|
||||
@user = User.find(params[:id])
|
||||
@user.destroy
|
|
@ -6,6 +6,25 @@ class ApplicationController < ActionController::Base
|
|||
helper :all
|
||||
before_filter :set_locale, :set_site
|
||||
|
||||
def get_all_app_engines
|
||||
ary = ["vender/plugins/NewBlog"]
|
||||
app_engines = ary.collect{|t|
|
||||
Rails::Engine.find t
|
||||
}
|
||||
app_engines.each{ |t|
|
||||
# t.
|
||||
}
|
||||
end
|
||||
|
||||
def flaten_controller
|
||||
ary=[]
|
||||
Find.find(File.join(Rails.root , 'vendor/plugins/')) { |name|
|
||||
require_dependency(name) if /_controller\.rb$/ =~ name
|
||||
ary << name
|
||||
}
|
||||
ary
|
||||
end
|
||||
|
||||
# Find the parent for the given item
|
||||
def find_parent_item
|
||||
@parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil
|
||||
|
@ -25,6 +44,8 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
# Set I18n.locale
|
||||
def set_locale
|
||||
# update session if passed
|
||||
|
@ -56,4 +77,26 @@ class ApplicationController < ActionController::Base
|
|||
session[:current_page] = params[:id] || @item.id rescue nil
|
||||
end
|
||||
|
||||
def decrypt_data(encrypted_data, encrypted_key, encrypted_iv)
|
||||
site = Site.find(session[:site])
|
||||
if encrypted_data
|
||||
private_key = OpenSSL::PKey::RSA.new(site.private_key)
|
||||
cipher = OpenSSL::Cipher.new('aes-256-cbc')
|
||||
cipher.decrypt
|
||||
cipher.key = private_key.private_decrypt(encrypted_key)
|
||||
cipher.iv = private_key.private_decrypt(encrypted_iv)
|
||||
|
||||
decrypted_data = cipher.update(encrypted_data)
|
||||
decrypted_data << cipher.final
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
def get_homepage
|
||||
Item.first(:conditions => {:parent_id => nil})
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
require 'mongo'
|
||||
|
||||
class GridfsController < ActionController::Metal
|
||||
|
||||
def serve
|
||||
gridfs_path = env["PATH_INFO"].gsub("/gridfs/", "")
|
||||
begin
|
||||
gridfs_file = Mongo::GridFileSystem.new(Mongoid.database).open(gridfs_path, 'r')
|
||||
self.response_body = gridfs_file.read
|
||||
self.content_type = gridfs_file.content_type
|
||||
rescue
|
||||
self.status = :file_not_found
|
||||
self.content_type = 'text/plain'
|
||||
self.response_body = ''
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,18 +0,0 @@
|
|||
class SitesController < ApplicationController
|
||||
|
||||
#layout 'set_up'
|
||||
|
||||
def index
|
||||
@site = Site.first
|
||||
if @site
|
||||
@title = "site"
|
||||
else
|
||||
redirect_to :action => :new
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@site = Site.new
|
||||
end
|
||||
|
||||
end
|
|
@ -12,7 +12,7 @@ module Admin::ItemHelper
|
|||
ret << "<ul>"
|
||||
ret << "<li>"
|
||||
ret << (link_to node.name, dest)
|
||||
ret << ' | ' << (link_to t('admin.code'), eval("edit_admin_#{node._type.downcase}_path(node, :code => true)")) if node._type.eql?('Page')
|
||||
ret << ' | ' << (link_to t('admin.edit'), eval("edit_admin_#{node._type.downcase}_path(node)")) if node._type.eql?('Page')
|
||||
ret << ' | ' << (link_to t('admin.new_page'), new_admin_page_path(:parent_id => node.id), :class => 'new_page') if node._type.eql?('Page')
|
||||
ret << ' | ' << (link_to t('admin.new_link'), new_admin_link_path(:parent_id => node.id), :class => 'new_link') if node._type.eql?('Page')
|
||||
ret << ' | ' << (link_to t(:delete), eval("delete_admin_#{node._type.downcase}_path(node, :authenticity_token => form_authenticity_token)"), :confirm => t('sure?'), :class => 'delete')
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
module Admin::UserHelper
|
||||
|
||||
def show_user_attribute(object, key, locale = '')
|
||||
attribute = object.attribute_values.detect {|av| av.key.to_s.eql?(key.to_s) || av[locale.to_s].eql?(locale.to_s) } rescue nil
|
||||
if attribute
|
||||
if locale.to_s.blank?
|
||||
attribute['key']
|
||||
else
|
||||
attribute[locale.to_s]
|
||||
end
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
module DesignHelper
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,108 @@
|
|||
class Design
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :title
|
||||
field :author
|
||||
field :intro
|
||||
field :version
|
||||
|
||||
has_many :pages
|
||||
|
||||
embeds_one :layout
|
||||
embeds_one :default_css, :class_name => "Stylesheet"
|
||||
embeds_one :reset_css, :class_name => "Stylesheet"
|
||||
embeds_many :stylesheets
|
||||
embeds_many :themes
|
||||
embeds_many :javascripts
|
||||
embeds_many :images
|
||||
embeds_many :custom_images, as: :design_image
|
||||
|
||||
validates_presence_of :title
|
||||
validates_presence_of :author
|
||||
|
||||
after_save :procs_embedded_objects
|
||||
# after_destroy :del_embedded_objects
|
||||
|
||||
def javascripts=(*attrs)
|
||||
self.files = (attrs << 'javascripts')
|
||||
end
|
||||
|
||||
def themes=(*attrs)
|
||||
self.files = (attrs << 'themes')
|
||||
end
|
||||
|
||||
def images=(*attrs)
|
||||
self.files = (attrs << 'images')
|
||||
end
|
||||
|
||||
# Update or create the attribute_model records
|
||||
def files=(attrs)
|
||||
case attrs.last
|
||||
when 'layout'
|
||||
files = self.layout.build
|
||||
else
|
||||
files = eval(attrs.last)
|
||||
end
|
||||
attrs[0].each do |a|
|
||||
if a[:id].blank? && !a[:file].blank?
|
||||
files.build(:file => a[:file], :to_save => true)
|
||||
else
|
||||
files.each do |file|
|
||||
if file.id.to_s == a[:id]
|
||||
file.to_destroy = a[:to_destroy]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def del_embedded_objects
|
||||
[[self.layout],self.themes, self.javascripts, self.images].each do |objects|
|
||||
objects.each do |object|
|
||||
object.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def procs_embedded_objects
|
||||
[self.javascripts, self.images].each do |objects|
|
||||
objects.each do |object|
|
||||
process_object(object)
|
||||
end
|
||||
end
|
||||
if self.layout.to_save
|
||||
self.layout.to_save = false
|
||||
self.layout.save
|
||||
end
|
||||
[[self.default_css], [self.reset_css], self.themes].each do |objects|
|
||||
objects.each do |object|
|
||||
if object
|
||||
to_parse_url = object.to_save ? true : false
|
||||
process_object(object)
|
||||
object.parse_urls if to_parse_url
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def process_object(object)
|
||||
if object.to_save
|
||||
if object.file_filename.nil?
|
||||
new_object = self.send(object._type.downcase.pluralize).build(object)
|
||||
object.destroy
|
||||
new_object.to_save = false
|
||||
new_object.save
|
||||
else
|
||||
object.to_save = false
|
||||
object.save
|
||||
end
|
||||
end
|
||||
if object.to_destroy
|
||||
object.destroy
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class DesignFile
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
mount_uploader :file, AssetUploader
|
||||
|
||||
field :to_save, :type => Boolean
|
||||
field :to_destroy, :type => Boolean
|
||||
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class Image < DesignFile
|
||||
|
||||
field :in_css, :type => Boolean
|
||||
field :name
|
||||
field :html_id
|
||||
field :html_class
|
||||
|
||||
embedded_in :design_image, polymorphic: true
|
||||
|
||||
mount_uploader :file, ImageUploader
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class Javascript < DesignFile
|
||||
embedded_in :design
|
||||
end
|
|
@ -0,0 +1,24 @@
|
|||
class Layout < DesignFile
|
||||
include Parser
|
||||
|
||||
attr_reader :content
|
||||
|
||||
embeds_one :menu
|
||||
embedded_in :design
|
||||
embeds_many :layout_parts
|
||||
|
||||
after_save :parse_layout
|
||||
|
||||
def content
|
||||
self.file.read.force_encoding("UTF-8") rescue ''
|
||||
end
|
||||
|
||||
def self.exist_one?
|
||||
Layout.count > 0
|
||||
end
|
||||
|
||||
def parse_layout
|
||||
parse_layout_contents(self)
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,18 @@
|
|||
class LayoutPart
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :name
|
||||
field :id_tag
|
||||
field :editable, :type => Boolean
|
||||
field :class_tag
|
||||
field :content
|
||||
|
||||
embedded_in :layout
|
||||
|
||||
def editable?
|
||||
self.editable
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class Menu
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :levels, :type => Integer
|
||||
field :values, :type => Hash
|
||||
|
||||
embedded_in :layout
|
||||
|
||||
end
|
|
@ -0,0 +1,35 @@
|
|||
class Stylesheet < DesignFile
|
||||
embedded_in :design
|
||||
mount_uploader :file_orig, AssetUploader
|
||||
|
||||
def parse_urls
|
||||
orig_content = content = self.file.read.force_encoding("UTF-8")
|
||||
self.remove_file!
|
||||
self.remove_file_orig!
|
||||
names = []
|
||||
images = self.design.images
|
||||
content.scan(/(?<=url)(.*?)(?=\))/){
|
||||
css_name = $1.gsub(' ','').gsub('(','')
|
||||
name = File.basename(css_name).gsub(/[\\\"]/, '')
|
||||
file_name = images.detect{ |i| i.file_filename.eql?(name) }.file_url rescue nil
|
||||
names << [css_name, file_name]
|
||||
}
|
||||
names.each do |name|
|
||||
content.gsub!(name[0], name[1]) if name[1]
|
||||
end
|
||||
Dir.mktmpdir('f_path') { |dir|
|
||||
orig_file_name = self.file_filename
|
||||
|
||||
temp_file = File.new(dir + '/' + orig_file_name, 'w+')
|
||||
temp_file.write orig_content.force_encoding("UTF-8")
|
||||
self.file_orig = temp_file
|
||||
|
||||
temp_file = File.new(dir + '/' + orig_file_name, 'w+')
|
||||
temp_file.write content.force_encoding("UTF-8")
|
||||
self.file = temp_file
|
||||
|
||||
self.save
|
||||
}
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class Theme < Stylesheet
|
||||
embedded_in :design
|
||||
field :name
|
||||
|
||||
before_save :set_name
|
||||
|
||||
protected
|
||||
|
||||
def set_name
|
||||
self.name = File.basename(self.file_filename,".css")
|
||||
end
|
||||
|
||||
end
|
|
@ -1,21 +0,0 @@
|
|||
class Layout
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :name, :index => true
|
||||
field :description
|
||||
field :content
|
||||
|
||||
references_many :children, :class_name => "Item"
|
||||
has_many :layout_parts
|
||||
|
||||
validates_presence_of :name
|
||||
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
|
||||
validates_uniqueness_of :name
|
||||
|
||||
def self.exist_one?
|
||||
Layout.count > 0
|
||||
end
|
||||
|
||||
end
|
|
@ -1,11 +0,0 @@
|
|||
class LayoutPart
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :name
|
||||
field :content
|
||||
|
||||
belongs_to :layout
|
||||
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class ModuleApp
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :name_of_app
|
||||
field :version
|
||||
field :organization
|
||||
field :author
|
||||
field :intro
|
||||
field :update_info
|
||||
field :create_date
|
||||
|
||||
end
|
|
@ -1,20 +1,17 @@
|
|||
class Page < Item
|
||||
|
||||
#include LayoutSupport
|
||||
|
||||
field :content
|
||||
field :layout_name
|
||||
field :layout_id
|
||||
field :theme_id, :type => BSON::ObjectId, :default => nil
|
||||
|
||||
validates_presence_of :layout_name, :layout_id
|
||||
|
||||
referenced_in :layout
|
||||
belongs_to :design
|
||||
has_many :page_parts
|
||||
|
||||
embeds_many :custom_images, as: :design_image
|
||||
|
||||
def create_parts
|
||||
page_layout = self.get_layout
|
||||
page_layout.layout_parts.each do |p|
|
||||
self.page_parts.create( :name => p.name, :i18n_variable_id => I18nVariable.create.id, :kind => 'text' ) if p['editable']
|
||||
page_design = self.design
|
||||
page_design.layout.layout_parts.each do |p|
|
||||
self.page_parts.create( :name => p.name, :i18n_variable_id => I18nVariable.create.id, :kind => 'text' ) if p.editable?
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,19 +23,8 @@ class Page < Item
|
|||
end
|
||||
end
|
||||
|
||||
def get_layout
|
||||
Layout.find(layout_id)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def setup_default_value
|
||||
super
|
||||
|
||||
if self.layout_id
|
||||
self.layout_name = get_layout.name
|
||||
end
|
||||
|
||||
def is_home?
|
||||
self.parent ? false : true
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
class PDesign < Purchase
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class PModuleApp < Purchase
|
||||
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
class Purchase
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :purchase_id
|
||||
field :title
|
||||
field :author
|
||||
field :intro
|
||||
field :downloaded, :type => Boolean
|
||||
field :download_date, :type => Date
|
||||
|
||||
end
|
|
@ -6,4 +6,27 @@ class Site
|
|||
field :in_use_locales, :type => Array
|
||||
field :valid_locales, :type => Array
|
||||
|
||||
field :roaming_id
|
||||
field :private_key, :type => Binary
|
||||
field :public_key, :type => Binary
|
||||
|
||||
field :school
|
||||
field :department
|
||||
|
||||
def generate_keys
|
||||
private_key = OpenSSL::PKey::RSA.generate(2048)
|
||||
self.public_key = private_key.public_key.to_s
|
||||
self.private_key = private_key.to_s
|
||||
end
|
||||
|
||||
def registered?
|
||||
!self.roaming_id.blank?
|
||||
end
|
||||
|
||||
def up_to_date?
|
||||
p res = %x(git remote show origin)
|
||||
res = res.split('rails_3_1').pop.gsub('(', '').gsub(')','').strip rescue nil
|
||||
res.eql?('local out of date') ? false : true
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ class AttributeModel
|
|||
field :built_in, :type => Boolean, :default => false
|
||||
field :disabled, :type => Boolean, :default => false
|
||||
|
||||
embedded_in :user_attribute_model, :inverse_of => :attribute_models
|
||||
embedded_in :user_attribute_model
|
||||
validates_uniqueness_of :key
|
||||
|
||||
# Destroy the i18n_variable
|
||||
|
@ -29,7 +29,8 @@ class AttributeModel
|
|||
if self.i18n_variable_id
|
||||
self.i18n_variable.update_attributes(attr)
|
||||
else
|
||||
var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class, :parent_id => self.user_attribute_model.i18n_variable_id}))
|
||||
# var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class, :parent_id => self.user_attribute_model.i18n_variable_id}))
|
||||
var = I18nVariable.new(attr.merge({:key => self.key, :document_class => self.class}))
|
||||
var.save
|
||||
self.i18n_variable_id = var.id
|
||||
end
|