Compare commits

..
Author SHA1 Message Date
saurabhbhatia d47b300dcf Import Data, Sync Data
Conflicts:

	vendor/built_in_modules/personal_book/app/models/writing_book.rb
	vendor/built_in_modules/personal_conference/app/models/writing_conference.rb
	vendor/built_in_modules/personal_journal/app/models/writing_journal.rb
2013-10-18 12:02:48 +08:00
saurabhbhatia f85f6df8b1 NTU CPH initiated 2013-10-18 11:32:58 +08:00
chris 7b1b1fa2d3 Fix bug in open_for, it now takes all the open_for into account
Add open_for_user
2013-10-17 14:20:49 +08:00
Manson Wang a67be030c5 Fix JS Path 2013-10-17 11:21:46 +08:00
chris a76164465e Fix editing a tag module 2013-10-16 23:34:51 +08:00
saurabhbhatia d2459f42c0 Added Favicon and default image for orbitbar 2013-10-16 18:50:22 +08:00
saurabhbhatia 155039ac16 Updated fixes for site info - desktop openess, title always displayed 2013-10-16 18:33:57 +08:00
Manson Wang 2bcecc322e Update Ad_Banner for new jQuery
Removed loading module.js in module_widget.html.erb
2013-10-16 12:28:21 +08:00
Spen fbe6017382 new ui ask module lose 2 file 2013-10-16 10:31:16 +08:00
harrybomrah df5cda7a98 new feature added for not loading submenus inside api for desktop 2013-10-16 09:37:39 +08:00
harrybomrah fbea249782 jquery update and also fixed app manager bug .. jquery updated to 1.10.2 and jquery ui updated to 1.10.0 .. gem jquery-rails vs 2.1.4 changed to 3.0.4 and jquery-ui-rails changed to 4.0.5 2013-10-16 09:37:33 +08:00
chris 279ac774d4 Migrate form old ui to new ui (categories, tags and authorizations) 2013-10-15 23:38:44 +08:00
Manson Wang 11b880752d Fix Ad_Banner backend refresh page after edit banner 2013-10-15 19:50:01 +08:00
Manson Wang 76ba7087b2 Fix Ad_Banner frontend for IE8
Fix backend bug in editing banner
Translation Added
2013-10-15 19:37:12 +08:00
Spen b9fbba2962 fix new ui ask module frontend 2013-10-15 17:01:07 +08:00
saurabhbhatia 96c3be68f7 Fixed Enable and Disable, Sitemap and Terms of Use for header and footer 2013-10-15 10:37:49 +08:00
saurabhbhatia 5fb3731430 Show Custom orbit bar icon only for frontend and desktop 2013-10-15 10:07:46 +08:00
saurabhbhatia fb34dc673f Changeable Orbitbar logo 2013-10-14 18:20:26 +08:00
harrybomrah 14ea611f8c fixed file view on server for desktop 2013-10-14 16:49:54 +08:00
harrybomrah 4f04eca74f test for fileview in desktop on server 2013-10-14 16:49:51 +08:00
saurabhbhatia 4120be6f8e fixes in sitemap, site preference 2013-10-14 16:48:50 +08:00
saurabhbhatia ae66e7257f Added Rackprofile to development assets 2013-10-14 10:55:01 +08:00
saurabhbhatia 55fa1cef4f Added Enable and disable terms of use, sitemap 2013-10-11 13:14:37 +00:00
saurabhbhatia 5c8a57e700 Fixed Sitemap Toggle 2013-10-09 09:06:21 +00:00
saurabhbhatia 7ef2dacf00 Fix links in member module 2013-10-09 05:22:51 +00:00
chris 08a8d668ec Display de page contexts in the mobile version as set in structure 2013-10-08 18:11:29 +08:00
chris b4f5fddc5c Add option to skip authorization 2013-10-08 17:18:58 +08:00
chris 315a24556c Fix parser common to skip not found module_app
Do not show default widget if there's no data
2013-10-08 16:42:20 +08:00
chris cce68beff1 Quick fix for front end reloading 2013-10-08 14:52:24 +08:00
chris cf7f7aa29c Fix tag page slide issues 2013-10-08 12:47:31 +08:00
chris 5328a26440 Fix structure position 2013-10-08 12:33:24 +08:00
chris fe1869199e Fix typo, it wasn't executing the filtering on tags 2013-10-07 19:01:59 +08:00
chris 061225f56c Override mongoid-tree callback condition for default position 2013-10-07 18:23:54 +08:00
saurabhbhatia b3e16ce23b Updated desktop widgets controller 2013-10-07 18:13:55 +08:00
saurabhbhatia fad191aefe Updated Desktop Inheritence class 2013-10-07 17:47:13 +08:00
chris 2f866891b1 Limit rubyzip version 2013-10-07 16:25:47 +08:00
chris 48aa7ed638 Update rake for resetting position
Fix codemirror css
2013-10-07 16:23:07 +08:00
chris 21db2a2cba Drag and drop to reorder users 2013-10-07 15:53:54 +08:00
saurabhbhatia 1194bdd9b4 Updated Sitemap with UI fixes - checkbox tag pending 2013-10-07 15:05:50 +08:00
Manson Wang 831bd722b8 Fix site preference openness problem 2013-10-07 14:37:52 +08:00
saurabhbhatia 940a915125 Updated Sitemap with new UI 2013-10-07 09:43:47 +08:00
Manson Wang 792785f7ba Fix relation for Ad_banner and Ad_image
Update site.rake for New UI
2013-10-04 19:20:04 +08:00
chris 43cf6b70b7 Fix structure reorder position 2013-10-04 15:07:24 +08:00
saurabhbhatia ba8da9b6bb Updated button class in template form 2013-10-04 14:41:48 +08:00
saurabhbhatia ff93670949 Updated template editing 2013-10-04 14:41:31 +08:00
Spen f85354c2b6 fix new ui link and archive frontend and widget index 2013-10-04 11:51:36 +08:00
chris 06c48524fd Fix tag to remove ['0', '1'] from the form 2013-10-02 18:36:08 +08:00
chris 31ef12b3da Fix approval link in side bar 2013-10-02 15:35:42 +08:00
saurabhbhatia 08907aa8c1 Search Engine Preferences complete 2013-10-02 15:23:12 +08:00
saurabhbhatia 31b55a0635 Revert "Updated Orbit js to latest version"
This reverts commit b18e61a6c0.
2013-10-02 12:32:45 +08:00
chris 433c8d5da6 Fix link in category for authorization, fix update of auth users 2013-10-02 12:18:20 +08:00
saurabhbhatia b18e61a6c0 Updated Orbit js to latest version 2013-10-02 12:09:44 +08:00
saurabhbhatia 4fe2e31f0e Updated Global css to fix the line height 2013-10-01 17:51:07 +08:00
saurabhbhatia 31e4fb9f39 Updated sidebar line height 2013-10-01 17:47:58 +08:00
saurabhbhatia 9bdb633157 Updated with UI Changes 2013-10-01 17:39:21 +08:00
harrybomrah caca264b50 isotope fixed for all plugins for list and form. 2013-10-01 15:06:49 +08:00
saurabhbhatia 9a0e9ddc82 Revert "Updated Bulletins controller with announcement approval fix"
This reverts commit a9431ad17e.
2013-10-01 15:03:34 +08:00
saurabhbhatia 9f490c87d2 Fixed issue with member plugin delete label 2013-10-01 10:43:37 +08:00
saurabhbhatia a9431ad17e Updated Bulletins controller with announcement approval fix 2013-10-01 10:03:18 +08:00
saurabhbhatia d9ac24470f Updated Member plugin names to remove spaces and generate correct links 2013-09-30 18:25:18 +08:00
harrybomrah 2f673b20ad disabling changes in desktop, missed out in last one 2013-09-30 17:25:02 +08:00
harrybomrah 0a9fd6a4b5 some needed changes in api for desktop 2013-09-30 16:59:50 +08:00
harrybomrah 74ca99a581 delete and sequencing fixed for survey questions 2013-09-30 16:49:27 +08:00
chris dfec6f7642 Fix for user order 2013-09-27 12:46:19 +08:00
Spen 9186978551 new ui member plugin sort fix and user show avatar fix 2013-09-27 11:04:52 +08:00
chris 622534e5db Fix user order:
- gender color
 - add cancel button for input
2013-09-26 20:18:34 +08:00
harrybomrah 52c896d8c5 some backend code change for sharing personal plugin module content. Added sharing in desktop for all the modules. 2013-09-26 20:11:45 +08:00
Spen 028c689739 Change User.all to User.not_guest_user 2013-09-26 19:46:14 +08:00
chris f81894af90 User ordering
Run the task new_ui:save_users
2013-09-26 19:00:13 +08:00
Manson Wang dc3593c162 zh-tw for new ui 2013-09-26 17:13:17 +08:00
Manson Wang 16c26e3273 Fix path of jquery.cycle.all.latest.js 2013-09-26 16:11:08 +08:00
harrybomrah 5332162646 small add question fix for survey module. 2013-09-26 09:31:52 +08:00
harrybomrah 1d0ea6718f brief added to desktop for all plugins 2013-09-25 18:23:44 +08:00
harrybomrah 04ff345b94 survey edit completed 2013-09-25 17:29:38 +08:00
harrybomrah 58fb2d1c73 external links and link widget fixed for development 2013-09-24 15:37:40 +08:00
Spen a067bcd304 Add Brief intro. for all personal plugins
Add Share Setting for Personal Plugins ( if have old data must be add default value "field: is_hidden => false " )
Apply New UI to Member Plugin Edit Page
Personal Plugin Summary fix
Academic Info. list fix
2013-09-18 18:55:40 +08:00
saurabhbhatia b487740035 Fixed Pagination Errors in member module 2013-09-18 16:11:17 +08:00
harrybomrah 1e3cffee0a add page completed with attributes and reordering 2013-09-17 15:34:34 +08:00
harrybomrah e4a16eab3a commit for survey questions 2013-09-17 15:34:23 +08:00
harrybomrah e45b7e09a0 half survey module form changed to new ui plus one calendar fix 2013-09-16 12:25:58 +08:00
harrybomrah bd3462df7f small change left in last commit. commiting for gallery widget 2013-09-16 11:19:24 +08:00
harrybomrah f5f1822f0a no data file added 2013-09-16 11:19:18 +08:00
harrybomrah d532ded8e4 widget code for gallery rewritten for new_ui 2013-09-16 11:19:11 +08:00
chris 8456a91968 Fix structure edit 2013-09-14 17:26:16 +08:00
chris ba7ac5d954 Fix [app_name]_category_with_title and change announcement init 2013-09-14 11:54:35 +08:00
Spen 9cc1e95cb1 announcement add new widget bulletins_and_links
Conflicts:
	vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_bulletins.html.erb
2013-09-14 11:52:19 +08:00
chris c1cbfddf4b Fix for user and role relationship (from role and sub-role side) 2013-09-13 17:39:01 +08:00
harrybomrah 3595c59810 some unmerged code i pushd 3 months back not update by chris 2013-09-13 15:58:42 +08:00
harrybomrah 789e02e313 ad_banner banner load fixed for test site 2013-09-13 14:23:44 +08:00
Manson Wang bb8bc9a529 Added missing translation for gallery 2013-09-12 10:10:37 +08:00
Manson 6430e60577 Added the missing translations in config/locales/en.yml and zh_tw.yml
Conflicts:
	config/locales/en.yml
	config/locales/zh_tw.yml
2013-09-12 09:30:07 +08:00
chris 17d7912e07 Ray's js code for status in form 2013-09-11 19:24:58 +08:00
chris 911cfdc980 Move js into a file for status in form 2013-09-11 18:38:56 +08:00
harrybomrah 579bc3c245 some very small fix for image alternative text and browse files manager 2013-09-11 14:03:25 +08:00
harrybomrah 8c98645a69 small bug fix for inserting and delete button. 2013-09-11 14:03:19 +08:00
harrybomrah 9e10a3c944 editing for the assets are done with replacable files and description 2013-09-11 14:03:13 +08:00
harrybomrah f920a4f6ba filemanager and some update for file uploader . added file uploader to kernel 2013-09-11 14:03:06 +08:00
chris 3328a41b55 Put back js that was deleted by mistake 2013-09-11 14:01:06 +08:00
chris 06203d27b9 Fix for user and role relationship 2013-09-11 14:00:41 +08:00
saurabhbhatia 865be29b37 Updated Preference Page 2013-09-09 11:29:46 +08:00
saurabhbhatia 0eeb7db1a8 Updated preference UI 2013-09-09 11:02:58 +08:00
saurabhbhatia 7216676c40 Updated Sidebar and Preferences 2013-09-09 10:18:14 +08:00
saurabhbhatia fa857cfeea Default Locale 2013-09-06 18:00:36 +08:00
saurabhbhatia a3f1b8d54a Updated Preferences in Site Info 2013-09-06 18:00:30 +08:00
saurabhbhatia e9d6fa8787 Preference Page 2013-09-06 18:00:28 +08:00
saurabhbhatia 6e032a8757 Add Preference and search engine 2013-09-06 18:00:23 +08:00
saurabhbhatia 1558cfdb4e Updated Sitebar with Search Engine 2013-09-06 18:00:21 +08:00
saurabhbhatia 9e4686a565 Fixed Site Info completely and added search engine page 2013-09-06 18:00:18 +08:00
saurabhbhatia fef7cc4ed2 Updated Site info 2013-09-06 18:00:10 +08:00
saurabhbhatia 7f0821ea84 Updated Site info page to new ui 2013-09-06 17:59:56 +08:00
saurabhbhatia 2c0761aafb Updated Sitemap to New UI 2013-09-06 17:59:54 +08:00
saurabhbhatia 1e5ad750cd Updated Site bar with correct links 2013-09-06 17:59:43 +08:00
harrybomrah 335991e152 by mistake pushed code with debugger 2013-09-05 12:51:15 +08:00
harrybomrah 131dd3fea8 child images tag adding and deleting updated. 2013-09-05 12:51:13 +08:00
chris 6d8698af63 Comment out included css from member front 2013-09-03 17:09:47 +08:00
Matt K. Fu 00ddd94314 fix design index 2013-09-03 15:20:48 +08:00
chris 8045a18230 Change modal delete to take an "remote" option 2013-09-03 15:04:05 +08:00
Spen 81a89d2d7c new ui member image js fix 2013-09-02 14:37:35 +08:00
harrybomrah 4209356e9d new features in gallery image view.. and also tags for gallery completed. 2013-09-02 11:23:01 +08:00
Spen 3123c5de0a new ui member bug and interface fix 2013-09-02 11:22:17 +08:00
harrybomrah 82b6be483a isotope embedded inside desktop kernel 2013-08-30 10:58:08 +08:00
harrybomrah ff64fb5230 file title translations fixed 2013-08-30 10:57:54 +08:00
saurabhbhatia 2bc9d3424a Deleted unused module 2013-08-27 15:10:10 +08:00
saurabhbhatia 5591b06ee6 Ask Module for New UI 2013-08-27 12:38:06 +08:00
saurabhbhatia b970ea1e0e Updated Authorization for member, link, tag, archive 2013-08-27 10:14:39 +08:00
saurabhbhatia 155722519b Module Auth for video 2013-08-23 15:22:21 +08:00
chris 45e987d6f5 Fix for authorization
Dashboard and page authorisation
2013-08-23 12:08:33 +08:00
harrybomrah 399dfad392 faq authorization completed. 2013-08-22 18:00:05 +08:00
saurabhbhatia 53e5c57970 Commented Dashboard Public Visibility and fall back on no-filter defined authorization 2013-08-22 16:43:11 +08:00
saurabhbhatia e75873273c Updated Gallery with authorizations 2013-08-22 16:25:11 +08:00
saurabhbhatia 4c217ec12f Updated Authorizations for Adbanner, Calendar, Location 2013-08-22 15:20:50 +08:00
saurabhbhatia 452da1b8ec Updated Desktop Themes controller 2013-08-22 14:14:19 +08:00
chris ec40591489 Make the filter for authorisation easier for developers 2013-08-22 12:17:50 +08:00
Spen 4078d426a6 new ui personal front_end page(member app) & users_new_interface show sub_roles fix 2013-08-21 14:13:36 +08:00
chris c474fa063f New authorization 2013-08-21 13:42:29 +08:00
chris d24bd176cc Changes in datetimepicker to accepts formats in options 2013-08-21 13:42:29 +08:00
596 changed files with 13437 additions and 6364 deletions

No files matched your search

+6 -3
View File
@@ -11,13 +11,14 @@ gem "net-ldap", "~> 0.3.1"
gem 'devise', '1.5.3' gem 'devise', '1.5.3'
gem 'exception_notification' # Send error trace gem 'exception_notification' # Send error trace
gem 'execjs' gem 'execjs'
gem 'jquery-rails', '2.1.4' gem 'jquery-rails', '3.0.4'
gem 'jquery-ui-rails' gem 'jquery-ui-rails', "4.0.5"
gem "select2-rails", '3.3.1' gem "select2-rails", '3.3.1'
gem 'kaminari' gem 'kaminari'
gem 'time_difference' gem 'time_difference'
gem "acts_as_unvlogable" gem "acts_as_unvlogable"
gem 'youtube_it' gem 'youtube_it'
gem 'gotcha'
# gem "memcached", "~> 1.4.3" # gem "memcached", "~> 1.4.3"
# gem "memcache-client" # gem "memcache-client"
@@ -38,7 +39,7 @@ gem 'resque-scheduler' # job scheduling
gem 'resque-restriction' gem 'resque-restriction'
#gem 'rb-readline' #gem 'rb-readline'
# gem 'ruby-debug19' # gem 'ruby-debug19'
gem 'rubyzip' gem 'rubyzip', '< 1.0.0'
gem 'sunspot_mongo' gem 'sunspot_mongo'
gem 'sunspot_solr' gem 'sunspot_solr'
@@ -97,6 +98,8 @@ group :test, :development do
gem "watchr" gem "watchr"
gem "spork" gem "spork"
gem "capybara" gem "capybara"
#gem 'rack-mini-profiler'
gem "better_errors"
# gem 'yard' # gem 'yard'
# gem "bluecloth" # gem "bluecloth"
end end
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

+102
View File
@@ -0,0 +1,102 @@
!function ($) {
$.fn.checkListLength = function (param){
_defaultSettings = {
onlyOne: null,
};
_set = $.extend(_defaultSettings, param);
$this = this;
$li = this.children('li');
$dropzone = $('#dropzone');
if(($li.length - _set.onlyOne) == 0) {
$('#dropzone').fadeIn(300);
} else {
$('#dropzone').fadeOut(300);
};
$('#file-list').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
}
}(window.jQuery);
$(function () {
'use strict';
// Initialize the jQuery File Upload widget:
$('#fileupload').fileupload({
maxFileSize: 5000000,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|pdf|doc|docx|ppt|pptx|xls|xlsx)$/i,
dropZone: $('#dropzone'),
headers:{
'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content")
}
}).bind('fileuploadstop', function (e, data) {
window.location.reload();
});
});
$(document).ready(function(){
var insertBtn = $("#insert_btn"),
deleteBtn = $("#delete_btn"),
url = null;
$("#asset_sort_list").on(clickEvent,"input[type=checkbox]",function(){
if($("#asset_sort_list input[type=checkbox]:checked").length == 1){
url = window.location.protocol + "//" + window.location.host + $("#url_" + $("input[type=checkbox]:checked").val()).val();
insertBtn.show();
}else{
insertBtn.hide();
url = null;
}
if($("#asset_sort_list input[type=checkbox]:checked").length)
deleteBtn.show();
else
deleteBtn.hide();
})
insertBtn.bind(clickEvent,function(){
var alt_text = $("#"+language+"_desc_"+$("input[type=checkbox]:checked").val()).val();
alt_text = (alt_text ? alt_text : "This is an image");
if(url){
window.opener.CKEDITOR.tools.callFunction( funcNum, url, function() {
var element,
dialog = this.getDialog();
if ( dialog.getName() == 'image' ) {
element = dialog.getContentElement( 'info', 'txtAlt' );
if ( element )
element.setValue( alt_text );
}
});
window.close();
}
})
deleteBtn.bind( clickEvent,function(){
var items_to_delete = [],
type = getUrlParam("type");
$("input[type=checkbox]:checked").each(function(){
items_to_delete.push($(this).val());
})
$.post("<%= delete_files_admin_assets_path %>",{"files":items_to_delete,"type":type},function(){
deleteBtn.hide();
})
})
var currentEdit = null;
$(document).on("ajax:success","form[data-remote=true]",function(evt, data, xhr){
currentEdit.replaceWith($(data));
$("#editform").modal("hide");
})
$("#asset_sort_list").on(clickEvent,".editform",function(){
currentEdit = $(this).parent().parent();
$.get($(this).attr("href"),function(data){
$("#editform").html(data).modal("show");
})
return false;
})
function getUrlParam( paramName ) {
var reParam = new RegExp( '(?:[\?&]|&)' + paramName + '=([^&]+)', 'i' ) ;
var match = window.location.search.match(reParam) ;
return ( match && match.length > 1 ) ? match[ 1 ] : null ;
}
var funcNum = getUrlParam( 'CKEditorFuncNum' ),
t = getUrlParam('CKEditor').split("_"),
language = t[t.length-1];
language = (language == "tw" ? "zh_tw" : language);
})
+33 -21
View File
@@ -38,7 +38,11 @@ if($.support.touch) {
$checked.each(function() { $checked.each(function() {
if(!$(this).closest('div').hasClass('togglebox')) { if(!$(this).closest('div').hasClass('togglebox')) {
$(this).wrap('<div class="toggle-control"/>'); $(this).wrap('<div class="toggle-control"/>');
$(this).wrap('<div class="togglebox" />'); if($(this).attr('type') == "hidden" && $(this).attr('value')) {
$(this).wrap('<div class="togglebox disabled" />');
} else {
$(this).wrap('<div class="togglebox" />');
}
$('<label><b></b></label>').insertAfter($(this)); $('<label><b></b></label>').insertAfter($(this));
if($(this).data().deploy) { if($(this).data().deploy) {
switch($(this).data().deploy) { switch($(this).data().deploy) {
@@ -252,8 +256,8 @@ if($.support.touch) {
$arrow = $('.sub-nav-arrow'), $arrow = $('.sub-nav-arrow'),
$wrap = $('#main-wrap'), $wrap = $('#main-wrap'),
$wrapLeft = $wrap.css('margin-left'), $wrapLeft = $wrap.css('margin-left'),
$position = 0, $position = $arrow.outerHeight(true)*-1,
$arrowHeightFormat = $('.position').height()-8; $arrowHeightFormat = $arrow.outerHeight(true)/2;
if($('#sidebar').length>0) { if($('#sidebar').length>0) {
$wrap.css({'margin-left': 61}); $wrap.css({'margin-left': 61});
$wrapLeft = 61; $wrapLeft = 61;
@@ -270,7 +274,7 @@ if($.support.touch) {
} }
// Arrow defaults position // Arrow defaults position
$position = $el.eq($elIndex).offset().top-$el.eq($elIndex).height()/2+$arrowHeightFormat-$(document).scrollTop(); $position = $el.eq($elIndex).position().top+$el.eq($elIndex).height()/2-$arrowHeightFormat+$('.scroller').position().top;
$arrow.css({ $arrow.css({
'top': $position, 'top': $position,
}); });
@@ -281,7 +285,7 @@ if($.support.touch) {
$el.on(mouseenterEvent, function(e) { $el.on(mouseenterEvent, function(e) {
$block.siblings().removeClass('show').eq($(this).index()).addClass('show'); $block.siblings().removeClass('show').eq($(this).index()).addClass('show');
$arrow.stop(true, false).animate({ $arrow.stop(true, false).animate({
top: ($(this).offset().top-$(this).height()/2)+$arrowHeightFormat-$(document).scrollTop(), top: ($(this).position().top+$(this).height()/2)-$arrowHeightFormat+$('.scroller').position().top,
},{ },{
duration: 500, duration: 500,
easing: 'easeInOutBack', easing: 'easeInOutBack',
@@ -325,7 +329,7 @@ if($.support.touch) {
}) })
}; };
// $el.on('mouseleave', function() { // $el.on('mouseleave', function() {
// $el.hasClass('active') ? $position = $el.eq($elIndex).offset().top-$el.eq($elIndex).height()/2+$arrowHeightFormat-$(document).scrollTop() : 0; // $el.hasClass('active') ? $position = $el.eq($elIndex).position().top+$el.eq($elIndex).height()/2-$arrowHeightFormat+$('.scroller').position().top;
// $(this).hasClass('active') ? '':$(this).children('span').removeClass('hover'); // $(this).hasClass('active') ? '':$(this).children('span').removeClass('hover');
// }); // });
$block.on({ $block.on({
@@ -372,9 +376,9 @@ if($.support.touch) {
if($elIndex === null) { if($elIndex === null) {
$position = 0; $position = $arrow.outerHeight(true)*-1;
} else { } else {
$position = $el.eq($elIndex).offset().top-$el.eq($elIndex).height()/2+$arrowHeightFormat-$(document).scrollTop(); $position = $el.eq($elIndex).position().top+$el.eq($elIndex).height()/2-$arrowHeightFormat+$('.scroller').position().top;
} }
$arrow.stop(true, false).animate({ $arrow.stop(true, false).animate({
top: $position, top: $position,
@@ -409,8 +413,8 @@ if($.support.touch) {
}); });
// Sidebar Nav Drag // Sidebar Nav Drag
if(/MSIE 8.0/g.test($ua)){ if(/MSIE 8.0/g.test($ua)){
$arrow.remove();
$sidebarMenu.addClass('nano') $sidebarMenu.addClass('nano')
.css({'position': 'relative', 'top': '0px'})
.children('.scroller') .children('.scroller')
.addClass('content') .addClass('content')
.removeClass('scroller'); .removeClass('scroller');
@@ -472,6 +476,15 @@ if($.support.touch) {
}(window.jQuery); }(window.jQuery);
var ini = function() {
api = this
api.modal = function(e) {
$('#dialog a.delete-item').attr("href", e);
$('#dialog').modal('show');
}
}
var ini = function() { var ini = function() {
api = this api = this
api.modal = function(e) { api.modal = function(e) {
@@ -490,15 +503,14 @@ function openSlide() {
$(window).resize(function() { $(window).resize(function() {
$(this).width() > 1440 ? $pageslideW = 1024 : $pageslideW = 954; $(this).width() > 1440 ? $pageslideW = 1024 : $pageslideW = 954;
}) })
$openSlide.each(function() { if($('.item-groups').length) {
if($(this).hasClass('view-page')) { $os = $openSlide.not('.view-page');
$(this).pageslide({ W: $pageslideW, iframe: true }); $vp = $openSlide.filter('.view-page.open-slide');
} else if($('.item-groups').length) { $os.pageslide({ W: 624 });
$(this).pageslide({ W: 324 }); $vp.pageslide({ W: $pageslideW, iframe: true });
} else { } else {
$(this).pageslide(); $openSlide.pageslide();
}; };
});
$('.bottomnav .open-slide').on('click', function() { $('.bottomnav .open-slide').on('click', function() {
$('.table tr').removeClass('active'); $('.table tr').removeClass('active');
$('.filter-item').removeClass('active') $('.filter-item').removeClass('active')
@@ -506,8 +518,8 @@ function openSlide() {
} }
function formTip() { function formTip() {
if($('.main-forms').length && $('.add-on').length) { if($('.main-forms').length && $('.add-on').length || $('.phtot-action').length) {
$('.main-forms .add-on, .main-forms .file-link').tooltip({ $('.main-forms .add-on, .main-forms .file-link, .phtot-action li').tooltip({
position: { position: {
my: "center bottom-4", my: "center bottom-4",
at: "center top" at: "center top"
@@ -565,7 +577,7 @@ $(function() {
if($('#sidebar').length) { if($('#sidebar').length) {
if(!/MSIE 8.0/g.test(navigator.userAgent)){ if(!/MSIE 8.0/g.test(navigator.userAgent)){
document.getElementById('sidebar').addEventListener('touchmove', function (e) { e.preventDefault(); }, false); document.getElementById('sidebar').addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
}; }
} }
if($('#pageslide').length) { if($('#pageslide').length) {
openSlide(); openSlide();
@@ -26,10 +26,11 @@ CKEDITOR.editorConfig = function( config ) {
// config.filebrowserImageBrowseUrl = '/browser/browse.php?type=Images'; // config.filebrowserImageBrowseUrl = '/browser/browse.php?type=Images';
// config.filebrowserUploadUrl = '/uploader/upload.php'; // config.filebrowserUploadUrl = '/uploader/upload.php';
config.filebrowserBrowseUrl = "<%= Rails.application.routes.url_helpers.file_upload_admin_assets_path %>" config.filebrowserBrowseUrl = "<%= Rails.application.routes.url_helpers.admin_assets_path %>?module_app_id=<%= ModuleApp.first(conditions: {title: 'Asset'}).id.to_s %>";
config.filebrowserUploadUrl = "<%= Rails.application.routes.url_helpers.file_upload_admin_assets_path %>" config.filebrowserImageBrowseUrl = "<%= Rails.application.routes.url_helpers.admin_assets_path %>?type=images&module_app_id=<%= ModuleApp.first(conditions: {title: 'Asset'}).id.to_s %>";
// config.filebrowserUploadUrl = "<%= Rails.application.routes.url_helpers.file_upload_admin_assets_path %>";
config.contentsCss = '/orbit_4.0.1/assets/javascripts/lib/ckeditor/plugins/stylesheetparser/samples/assets/sample.css'; // config.contentsCss = '/orbit_4.0.1/assets/javascripts/lib/ckeditor/plugins/stylesheetparser/samples/assets/sample.css';
// Load from a list of definitions. // Load from a list of definitions.
// config.stylesSet = [ // config.stylesSet = [
+10
View File
@@ -0,0 +1,10 @@
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
(function(a){CKEDITOR.config.jqueryOverrideVal="undefined"==typeof CKEDITOR.config.jqueryOverrideVal?!0:CKEDITOR.config.jqueryOverrideVal;"undefined"!=typeof a&&(a.extend(a.fn,{ckeditorGet:function(){var a=this.eq(0).data("ckeditorInstance");if(!a)throw"CKEditor is not initialized yet, use ckeditor() with a callback.";return a},ckeditor:function(g,d){if(!CKEDITOR.env.isCompatible)throw Error("The environment is incompatible.");if(!a.isFunction(g))var k=d,d=g,g=k;var i=[],d=d||{};this.each(function(){var b=
a(this),c=b.data("ckeditorInstance"),f=b.data("_ckeditorInstanceLock"),h=this,j=new a.Deferred;i.push(j.promise());if(c&&!f)g&&g.apply(c,[this]),j.resolve();else if(f)c.once("instanceReady",function(){setTimeout(function(){c.element?(c.element.$==h&&g&&g.apply(c,[h]),j.resolve()):setTimeout(arguments.callee,100)},0)},null,null,9999);else{if(d.autoUpdateElement||"undefined"==typeof d.autoUpdateElement&&CKEDITOR.config.autoUpdateElement)d.autoUpdateElementJquery=!0;d.autoUpdateElement=!1;b.data("_ckeditorInstanceLock",
!0);c=a(this).is("textarea")?CKEDITOR.replace(h,d):CKEDITOR.inline(h,d);b.data("ckeditorInstance",c);c.on("instanceReady",function(d){var e=d.editor;setTimeout(function(){if(e.element){d.removeListener();e.on("dataReady",function(){b.trigger("dataReady.ckeditor",[e])});e.on("setData",function(a){b.trigger("setData.ckeditor",[e,a.data])});e.on("getData",function(a){b.trigger("getData.ckeditor",[e,a.data])},999);e.on("destroy",function(){b.trigger("destroy.ckeditor",[e])});e.on("save",function(){a(h.form).submit();
return!1},null,null,20);if(e.config.autoUpdateElementJquery&&b.is("textarea")&&a(h.form).length){var c=function(){b.ckeditor(function(){e.updateElement()})};a(h.form).submit(c);a(h.form).bind("form-pre-serialize",c);b.bind("destroy.ckeditor",function(){a(h.form).unbind("submit",c);a(h.form).unbind("form-pre-serialize",c)})}e.on("destroy",function(){b.removeData("ckeditorInstance")});b.removeData("_ckeditorInstanceLock");b.trigger("instanceReady.ckeditor",[e]);g&&g.apply(e,[h]);j.resolve()}else setTimeout(arguments.callee,
100)},0)},null,null,9999)}});var f=new a.Deferred;this.promise=f.promise();a.when.apply(this,i).then(function(){f.resolve()});this.editor=this.eq(0).data("ckeditorInstance");return this}}),CKEDITOR.config.jqueryOverrideVal&&(a.fn.val=CKEDITOR.tools.override(a.fn.val,function(g){return function(d){if(arguments.length){var k=this,i=[],f=this.each(function(){var b=a(this),c=b.data("ckeditorInstance");if(b.is("textarea")&&c){var f=new a.Deferred;c.setData(d,function(){f.resolve()});i.push(f.promise());
return!0}return g.call(b,d)});if(i.length){var b=new a.Deferred;a.when.apply(this,i).done(function(){b.resolveWith(k)});return b.promise()}return f}var f=a(this).eq(0),c=f.data("ckeditorInstance");return f.is("textarea")&&c?c.getData():g.call(f)}})))})(window.jQuery);
+4 -1
View File
@@ -6,7 +6,7 @@
// //
//= require jquery //= require jquery
//= require jquery_ujs //= require jquery_ujs
//= require jquery-ui //= require jquery.ui.all
//= require desktop/jquery.form //= require desktop/jquery.form
//= require desktop/jquery.tinyscrollbar //= require desktop/jquery.tinyscrollbar
//= require desktop/jquery.miniColors.min //= require desktop/jquery.miniColors.min
@@ -19,3 +19,6 @@
//= require select2 //= require select2
//= require jquery.isotope.min.js //= require jquery.isotope.min.js
//= require orbit_js_1.0.1-front-end //= require orbit_js_1.0.1-front-end
//= require ckeditor/init
//= require ckeditor/jquery-ckeditor
+99 -52
View File
@@ -20,6 +20,7 @@
//for forms //for forms
//form-type = "ajax_form" will turn form to ajax submit //form-type = "ajax_form" will turn form to ajax submit
//notification = string will display after the form is succesfully submitted //notification = string will display after the form is succesfully submitted
//response-type = "json"|"script"|"xml|html" default is json
//for layout tinyscrollbar //for layout tinyscrollbar
//content-layout="datalist|column|simple" datalist is for data list from database.. column is usually for forms and some other pages.. simple is without any columns, the page will be displayed as it is.. base width will be considered the default width for tinyscrollbar //content-layout="datalist|column|simple" datalist is for data list from database.. column is usually for forms and some other pages.. simple is without any columns, the page will be displayed as it is.. base width will be considered the default width for tinyscrollbar
@@ -28,6 +29,9 @@
//column="true" this option is only for column layout... the columns will be formed on this column=true attribute and it should be a div //column="true" this option is only for column layout... the columns will be formed on this column=true attribute and it should be a div
//item=true this attribute should be present in the li tag. li with this attribute are considered as a separate item. //item=true this attribute should be present in the li tag. li with this attribute are considered as a separate item.
//enableLanguageSelect( dom ) children <a> will be binded with language, data-lang = string ex "en"|"zh_tw" will toggle all data-langunage throughout the page
//enableSharing( dom ) children <a> will be binded with share, data-mode = string ex "public"|"private" will change the mode for all the selected items. the dom with class should have data-link = url data-var = vaiable_name, default will be mode
$.extend($.expr[':'], { $.extend($.expr[':'], {
'containsi': function (elem, i, match, array) { 'containsi': function (elem, i, match, array) {
@@ -164,7 +168,7 @@ var orbitDesktop = function(dom){
o.loadIconCache(); o.loadIconCache();
var custom_load = window.location.hash; var custom_load = window.location.hash;
if(!custom_load){ if(!custom_load){
$(o.contentHolder).empty().load("/desktop/desktop",function(){ $(o.contentHolder).empty().load("/desktop/desktop_container",function(){
o.desktopData["d_desktop"] = ""; o.desktopData["d_desktop"] = "";
o.initializeDesktop("d_desktop","",false); o.initializeDesktop("d_desktop","",false);
}) })
@@ -222,7 +226,8 @@ var orbitDesktop = function(dom){
this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc
$(".docklist a").click(function(){ $(".docklist a").click(function(){
o.menu_item($(this)); if( !$( this ).parent().hasClass( 'disable' ) )
o.menu_item($(this));
return false; return false;
}); });
@@ -247,16 +252,12 @@ var orbitDesktop = function(dom){
$("body").on("submit","form[form-type=ajax_form]",function(){ $("body").on("submit","form[form-type=ajax_form]",function(){
var callback_method = $(this).attr("callback-method"), var callback_method = $(this).attr("callback-method"),
dt = null, dt = ($(this).attr("response-type") == null ? "json" : $(this).attr("response-type")),
notification = $(this).attr("notification"); notification = $(this).attr("notification");
dt = $(this).attr("response-type");
if(dt == null){
dt = "json";
}
var options = { var options = {
dataType : dt, dataType : dt,
resetForm : true, resetForm : false,
success:function(responseText, statusText, xhr, $form){ success: function(responseText, statusText, xhr, $form){
if(typeof callback_method != "undefined"){ if(typeof callback_method != "undefined"){
if(callback_method != ""){ if(callback_method != ""){
window.o[o.data_method][callback_method](responseText,statusText,xhr,$form); window.o[o.data_method][callback_method](responseText,statusText,xhr,$form);
@@ -265,7 +266,7 @@ var orbitDesktop = function(dom){
if(typeof notification == "string") if(typeof notification == "string")
o.notify(notification,"success"); o.notify(notification,"success");
}, },
error:function(){ error: function(){
o.notify("Please try again later!","imp"); o.notify("Please try again later!","imp");
} }
} }
@@ -274,10 +275,11 @@ var orbitDesktop = function(dom){
}); });
$("body").on("click","*[ajax-remote]",function(){ $("body").on("click","*[ajax-remote]",function(){
var $e = $(this); var $e = $(this),
var t = $e.attr("ajax-remote"); t = $e.attr("ajax-remote"),
var classes_to_toggle = $e.attr("toggle-onclick"); classes_to_toggle = $e.attr("toggle-onclick"),
var exe = $e.attr("callback-method"); // (typeof $e.attr("callback-method") == "function"? $e.attr("callback-method") : ""); responsetype = $e.attr('response-type') ? $e.attr('response-type') : "html",
exe = $e.attr("callback-method"); // (typeof $e.attr("callback-method") == "function"? $e.attr("callback-method") : "");
if(classes_to_toggle){ if(classes_to_toggle){
$e.toggleClass(classes_to_toggle); $e.toggleClass(classes_to_toggle);
} }
@@ -289,9 +291,9 @@ var orbitDesktop = function(dom){
} }
var ca = $e.attr("content-holder"); var ca = $e.attr("content-holder");
var a = function(){ var a = function(){
$.ajax({ $.ajax({
type : t, type : t,
dataType : responsetype,
url : $e.attr("href"), url : $e.attr("href"),
success : function(data){ success : function(data){
if(typeof data == "string"){ if(typeof data == "string"){
@@ -302,6 +304,7 @@ var orbitDesktop = function(dom){
// $("div[container=true]").html(data); // $("div[container=true]").html(data);
} }
} }
if(exe) if(exe)
window.o[o.data_method][exe](data,$e); window.o[o.data_method][exe](data,$e);
if(t == "delete"){ if(t == "delete"){
@@ -451,7 +454,7 @@ var orbitDesktop = function(dom){
var ist = function(){ var ist = function(){
$('#holder').css('height', $('#container').height() - 72); $('#holder').css('height', $('#container').height() - 72);
$('.tinycanvas').css('height', $('#panel_r').height() - 36); $('.tinycanvas').css('height', $('#holder').height() - 36);
var dom = $("*[isotope=true]").isotope({ var dom = $("*[isotope=true]").isotope({
layoutMode: 'fitColumns', layoutMode: 'fitColumns',
onLayout: function($elems, instance){ onLayout: function($elems, instance){
@@ -602,10 +605,11 @@ var orbitDesktop = function(dom){
this.menu_item = function(dom,customload,submenuitem){ this.menu_item = function(dom,customload,submenuitem){
if(!customload)customload=false; if(!customload)customload=false;
var target = dom.attr("id"); var target = dom.attr("id"),
var url = dom.attr("href"); url = dom.attr("href"),
submenu_pass = ( dom.attr("sub-menu") == "false" ? false : true);
if(!url)return false; if(!url)return false;
o.data_method = dom.attr("callback-method"); o.data_method = dom.attr("callback-method");
if(o.currenthtml!=target){ if(o.currenthtml!=target){
if(o.desktopData[o.currentface] == "undefined"){ if(o.desktopData[o.currentface] == "undefined"){
@@ -626,33 +630,37 @@ var orbitDesktop = function(dom){
window.o[o.data_method](target,url,cache); window.o[o.data_method](target,url,cache);
} }
} }
try { if( submenu_pass ){
if(!customload){ try {
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); if(!customload){
} else {
if(submenuitem){
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"));
} else {
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data);
} else {
if(submenuitem){
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"));
} else {
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data);
}
} }
} } catch(EX){}
} catch(EX){} }
header_ani(); header_ani();
}); });
}else{ }else{
$(o.contentHolder).html(o.desktopData[o.currentface]); $(o.contentHolder).html(o.desktopData[o.currentface]);
try{ if( submenu_pass ){
if(!customload){ try{
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]); if(!customload){
}else{ o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]);
if(submenuitem) }else{
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"),o.desktopData[o.currentface]); if(submenuitem)
else o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"),o.desktopData[o.currentface]);
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]); else
} o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]);
}catch(EX){} }
}catch(EX){}
}
cache = (o.lastlink == "/desktop/app_manager" ? false : true); // cache = (o.lastlink == "/desktop/app_manager" ? false : true);
if(typeof o.data_method != "undefined"){ if(typeof o.data_method != "undefined"){
if(o.data_method != ""){ if(o.data_method != ""){
window.o[o.data_method](target,url,cache); window.o[o.data_method](target,url,cache);
@@ -698,6 +706,15 @@ var orbitDesktop = function(dom){
} }
}) })
o.highlight_sub_menu_item(dom); o.highlight_sub_menu_item(dom);
} else {
o.lastlink = dom.attr("href");
$.ajax({
url : dom.attr("href"),
type : "get",
success : function(data){
o.layout_data(data);
}
})
} }
if(dom.length == 0) if(dom.length == 0)
o.layout_data(data); o.layout_data(data);
@@ -1083,7 +1100,7 @@ var orbitDesktop = function(dom){
data : options, data : options,
success : function(data){ success : function(data){
if(data.success == "true"){ if(data.success == "true"){
if(dom.is(":checked")){ console.log("true"); if(dom.is(":checked")){
elementSettingsData[$e.data("id")].sections.push({"id" : dom.data("section"),"name":sectionDetails.name}); elementSettingsData[$e.data("id")].sections.push({"id" : dom.data("section"),"name":sectionDetails.name});
o.notify("Added to " + sectionDetails.name,"success"); o.notify("Added to " + sectionDetails.name,"success");
}else{ }else{
@@ -1107,20 +1124,16 @@ var orbitDesktop = function(dom){
var info_open = function(){ var info_open = function(){
if($appinfo.is(":hidden")){ if($appinfo.is(":hidden")){
$('.overview').stop().animate({'width': '+=480'},0 , function(){ $('.overview').stop().animate({'width': '+=480'},0 , function(){
$('.tinycanvas').tinyscrollbar_update(); // $('.tinycanvas').tinyscrollbar_update('relative');
}); });
$appinfo $appinfo
.css({ .css({
'display': 'block',
'margin-left': -480 'margin-left': -480
}) }).fadeIn(200)
.delay(300)
.animate({ .animate({
'margin-left': 0 'margin-left': 0
}, 500, 'easeInOutQuint'); }, 500, 'easeInOutQuint');
} else { }
$('.tinycanvas').tinyscrollbar_update();
}
} }
var info_close = function(){ var info_close = function(){
@@ -1131,13 +1144,11 @@ var orbitDesktop = function(dom){
'margin-left': -480 'margin-left': -480
},500 , 'easeInOutQuint', function(){ },500 , 'easeInOutQuint', function(){
$('.overview').animate({'width': '-=480'}, 0, function(){ $('.overview').animate({'width': '-=480'}, 0, function(){
$('.tinycanvas').tinyscrollbar_update(); // $('.tinycanvas').tinyscrollbar_update();
}); });
$(this).attr("style",""); $(this).fadeOut(300).attr("style","");
}); });
} else { }
$('.tinycanvas').tinyscrollbar_update();
}
} }
$(window).on('keydown', function(){ $(window).on('keydown', function(){
if($('#searchbox').val() == 'Search'){ if($('#searchbox').val() == 'Search'){
@@ -1868,6 +1879,42 @@ var orbitDesktop = function(dom){
} }
} }
} }
this.enablelanguageSelect = function(){
$(".language_select a").click(function(event) {
$("*[data-language]").hide();
$("*[data-language="+$(this).data("lang")+"]").show();
return false;
});
}
this.enableSharing = function( dom ){
var el = $( dom ),
variable = ( el.data( 'var' ) ? el.data( "var" ) : "mode"),
_url = el.data( 'link' ) + "?" + variable + "=",
classes = [];
el.find( "a" ).each( function(){
classes.push( $( this ).attr( "item-class" ) ? $( this ).attr( "item-class" ) : $( this ).data( 'mode' ) );
})
el.find( "a" ).click( function(){
var ids = [],
mode = $( this ).data( 'mode' ),
inject_class = $( this ).attr( 'item-class' ) ? $( this ).attr( 'item-class' ) : mode;
$( ".overview li[item=true] a.icon-check" ).each( function(){
ids.push( $( this ).data( 'id' ) );
$( "li[data-id="+ $( this ).data( 'id' ) +"]").removeClass( classes.join( " " ) ).addClass( inject_class );
})
$.ajax({
url : _url + mode,
data : {"ids" : ids},
datatype : "json",
})
return false;
})
}
this.minimizeBarManager = function(){ this.minimizeBarManager = function(){
var minimizedApps = [], var minimizedApps = [],
minimizeBar = $("#minimizebar"); minimizeBar = $("#minimizebar");
+46 -18
View File
@@ -1,30 +1,58 @@
var banners = [];
var banner_index = 0;
$(document).ready(function() { $(document).ready(function() {
$.each($(".dymanic_load"),function(){ $.each($(".dymanic_load"),function(){
if($(this).attr("path")==''){$(this).html("App setting Failed");} if($(this).attr("path")==''){
$(this).html("App setting Failed");
if($(this).attr("path")!=''){ }else{
ajax_load_proc($(this),$(this).attr("path")); // Check if this App is AD_Banner
} if($(this).attr("path").indexOf("show_banner")>0){
ajax_load_proc($(this),$(this).attr("path"),"true");
}else{
ajax_load_proc($(this),$(this).attr("path"),$(this).attr("path"));
} }
); }
$("#main_content").addClass("module");
}); });
function ajax_load_proc(wapper,url){ $("#main_content").addClass("module");
});
function ajax_load_proc(wapper,url,isBanner){
$.get(encodeURI(url), {}, function(respText,textSta,XML){ $.get(encodeURI(url), {}, function(respText,textSta,XML){
if (textSta == 'success') { if (textSta == 'success') {
wapper.html(respText); if(isBanner=="true"){
}; wapper.html(respText);
if(textSta == 'error') var banner = banners[banner_index];
wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>"); $(banner.banner_name+" > img").each(function(){
$(this).load(function(){ banner.image_loaded++; });
});
BannerCycle(banner_index);
banner_index++;
}else{
wapper.html(respText);
}
};
if(textSta == 'error')
wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>");
}); });
} }
// Ad Banner FX code [start] function BannerCycle(banner_index){
function getTimeout() { var banner = banners[banner_index];
return $(this).attr('time_to_next'); // Wait untill all images are loaded
} if (banner.image_loaded==$(banner.banner_name+" img").length){
$(banner.banner_name).cycle({
delay: -1000,
fx: banner.banner_fx,
timeout: banner.time_to_next,
pager: banner.banner_pager,
pagerAnchorBuilder: function(idx, slide) { return "<li><a href='#'></a></li>"; }
});
}else{
setTimeout("BannerCycle("+banner_index+")",500);
}
}
$(document).ready(function() { $(document).ready(function() {
$(document).on('click', '.slideshow img', function() $(document).on('click', '.slideshow img', function()
@@ -43,8 +43,14 @@ $(function(){
placeholder: 'placeholder', placeholder: 'placeholder',
startCollapsed: true, startCollapsed: true,
disableNesting: 'no-nest', disableNesting: 'no-nest',
stop: function(event, ui) { update: function(event, ui) {
$.post("<%= Rails.application.routes.url_helpers.admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: (ui.item.parent().closest('li').attr('id') || ui.item.parent().closest('ol').attr('id')), position: ui.item.index() } ); var position = null;
if($(ui.item).closest('ol').hasClass('item-groups')) {
position = $(ui.item).index() - 1;
} else {
position = $(ui.item).index();
};
$.post("<%= Rails.application.routes.url_helpers.admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: (ui.item.parent().closest('li').attr('id') || ui.item.parent().closest('ol').attr('id')), position: position } );
} }
}); });
$(".sortable").delegate(".brand, .delete", clickEvent, function(e){ $(".sortable").delegate(".brand, .delete", clickEvent, function(e){
@@ -7,32 +7,29 @@ function append_id(){
}; };
} }
$("div.editable").live("mouseenter mouseleave", function (event) { $(document).on('change', 'select', function(e) {
$(this).children('.edit_link').toggle(); if(!e.target.className == 'widget_field_select') {
switch(e.target.id) {
case 'page_module_app_id':
$.getScript($(this).attr('rel') + '?module_app_id='+$(this).val() + append_id());
break;
case 'page_app_frontend_url':
case 'page_part_widget_path':
$.getScript($(this).attr('rel') +'?frontend=' + $(this).val() + '&module_app_id=' + $("#module_app_list select").val() + append_id() );
break;
case 'page_design':
$.getScript($(this).attr('rel') + '?design_id=' + $(this).val() + append_id());
break;
case 'page_part_public_r_tag':
$.getScript($(this).attr('rel') + '?type=' + $(this).val() + append_id());
break;
};
} else {
$.getScript($(this).attr('rel') + '?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri')+ '&module_app_id=' +$("#page_module_app_id,page_part_module_app_id").val() + append_id() );
}
}); });
$("#page_design").live('change', function() { $(document).on('click', '.part_kind', function(event) {
$.getScript($(this).attr('rel') + '?design_id=' + $(this).val() + append_id());
});
$("#module_app_list select").live('change', function() {
$.getScript($(this).attr('rel') + '?module_app_id='+$(this).val() + append_id());
});
$("#widget_list select, #frontend_list select").live('change', function() {
$.getScript($(this).attr('rel') +'?frontend=' + $(this).val() + '&module_app_id=' + $("#module_app_list select").val() + append_id() );
});
$("#tag_list select").live('change', function() {
$.getScript($(this).attr('rel') + '?type=' + $(this).val() + append_id() );
});
$("select.widget_field_select").live('change', function() {
$.getScript($(this).attr('rel') + '?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri')+ '&module_app_id=' +$("#page_module_app_id,page_part_module_app_id").val() + append_id() );
});
$('.part_kind').live('click', function() {
$('.part_kind_partial').hide(); $('.part_kind_partial').hide();
$('#part_' + $(this).attr('value')).show(); $('#part_' + $(this).attr('value')).show();
}); });
@@ -0,0 +1,124 @@
/* ===================================================
* jquery-lite-image-resize v.1.0.1
* https://github.com/RayChang/jquery-lite-image-resize
* ===================================================
* How to use ?
*
* HTML element closest to the image to add class "resizeimg".
*
* Example:
* <div class="resizeimg">
* <img src="images url" />
* </div>
*
* Or you can use:
* $('your class').rsImg();
*
* Note : HTML structure must be a structure like the example above.
*
*/
!function ($) {
"use strict";
var ResizeImg = function(element) {
this.element = $(element);
this.element.data('exists', true);
};
ResizeImg.prototype.resize = function() {
var $img = this.element.children('img').eq(0),
elW = this.element.innerWidth(),
elH = this.element.innerHeight(),
elScale = elW/elH,
image = document.createElement("img");
image.src = $img.attr('src');
this.element.css({
'position': 'relative',
'overflow': 'hidden',
});
function imageLoadComplete() {
var imgW = image.width,
imgH = image.height,
imgScale = imgW/imgH,
portrait = {
'position': 'absolute',
'height': '100%',
'width': 'auto',
'max-width': 'none',
'left': '50%',
'top': 0,
'margin-left': imgW*(elH/imgH)/-2
},
landscape = {
'position': 'absolute',
'height': 'auto',
'max-height': 'none',
'width': '100%',
'left': 0,
'top': '50%',
'margin-top': imgH*(elW/imgW)/-2
},
center = {
'position': 'absolute',
'height': '100%',
'width': '100%',
'top': 0,
'left': 0
};
if(imgScale < 1) {
if(elScale < 1) {
if(elScale > imgScale) {
$img.css(landscape);
} else {
$img.css(portrait);
};
} else {
$img.css(landscape);
};
};
if(imgScale > 1) {
if(elScale > 1) {
if(elScale > imgScale) {
$img.css(landscape);
} else {
$img.css(portrait);
};
} else {
$img.css(portrait);
};
};
if(imgScale == 1) {
if(elScale < 1) {
$img.css(portrait);
} else if(elScale > 1) {
$img.css(landscape);
} else {
$img.css(center);
};
};
$img.fadeTo(500, 1);
}
if(/MSIE 8.0/g.test($ua)) {
imageLoadComplete();
} else {
image.onload = imageLoadComplete;
}
};
$.fn.rsImg = function () {
this.each(function () {
if(!$(this).data('exists')) {
$(this).children("img").fadeTo(0,0);
new ResizeImg(this).resize();
};
});
};
$(function() {
$('.resizeimg').rsImg();
});
}(window.jQuery);
+78 -41
View File
@@ -12,13 +12,14 @@
!(function($){ !(function($){
// Convenience vars for accessing elements // Convenience vars for accessing elements
var $body = $('#main-wrap'), var $body = $('#main-wrap'),
$bottomNav = $('.bottomnav'),
$pageslide = $('#pageslide'), $pageslide = $('#pageslide'),
$viewPage = $('#view-page'); $viewPage = $('#view-page');
var _sliding = false, // Mutex to assist closing only once var _sliding = false, // Mutex to assist closing only once
_lastCaller; // Used to keep track of last element to trigger pageslide _lastCaller; // Used to keep track of last element to trigger pageslide
// If the pageslide element doesn't exist, create it // If the pageslide element doesn't exist, create it
if( $pageslide.length == 0 ) { if( $pageslide.length == 0 ) {
$pageslide = $('<div />').attr( 'id', 'pageslide' ) $pageslide = $('<div />').attr( 'id', 'pageslide' )
.css( 'display', 'none' ) .css( 'display', 'none' )
@@ -28,11 +29,12 @@
/* /*
* Private methods * Private methods
*/ */
function _load( url, useIframe ) { function _load( url, useIframe, callback,element ) {
// Are we loading an element from the page or a URL? // Are we loading an element from the page or a URL?
if ( url.indexOf("#") === 0 ) { if ( url.indexOf("#") === 0 ) {
// Load a page element // Load a page element
$(url).clone(true).appendTo( $pageslide.empty() ).show(); $(url).clone(true).appendTo( $pageslide.empty() ).show();
if(callback)callback.call(this,$pageslide,element);
} else { } else {
// Load a URL. Into an iframe? // Load a URL. Into an iframe?
if( useIframe ) { if( useIframe ) {
@@ -49,9 +51,18 @@
$viewPage.find('.content').html( iframe ); $viewPage.find('.content').html( iframe );
$viewPage.clone(true).appendTo( $pageslide.empty() ).show(); $viewPage.clone(true).appendTo( $pageslide.empty() ).show();
$viewPage.find('.content').empty(); $viewPage.find('.content').empty();
if(callback)callback.call(this,$viewPage,element);
} else { } else {
$viewPage.find('.content').load(url, function(){ $viewPage.find('.content').load(url, function(){
$viewPage.clone(true).appendTo( $pageslide.empty() ).show(); $viewPage.clone(true).appendTo( $pageslide.empty() ).show();
if($('#filter-default-tag').length) {
$('#filter-default-tag').fastLiveFilter('.add-default-tags-list', '.filter-item', '.tag');
addTagsTab();
$('#view-page .card').cardCheck({
item: $('#view-page input[type="checkbox"]'),
});
};
if(callback)callback.call(this,$viewPage,element);
}); });
} }
@@ -64,10 +75,11 @@
function _start( direction, speed ) { function _start( direction, speed ) {
var slideWidth = $pageslide.outerWidth( true ), var slideWidth = $pageslide.outerWidth( true ),
bodyAnimateIn = {}, bodyAnimateIn = {},
bottomnavAnimateIn = {},
slideAnimateIn = {}; slideAnimateIn = {};
// If the slide is open or opening, just ignore the call // If the slide is open or opening, just ignore the call
if( $pageslide.is(':visible') || _sliding ) return; if( $pageslide.is(':visible') || _sliding ) return;
_sliding = true; _sliding = true;
switch( direction ) { switch( direction ) {
@@ -83,6 +95,7 @@
$pageslide.css({ left: '-' + (slideWidth-61) + 'px', right: 'auto' }); $pageslide.css({ left: '-' + (slideWidth-61) + 'px', right: 'auto' });
}; };
bodyAnimateIn['margin-left'] = '+=' + slideWidth; bodyAnimateIn['margin-left'] = '+=' + slideWidth;
bottomnavAnimateIn['left'] = '+=' + slideWidth;
if($(window).width() <= 1440 && slideWidth > 963 ) { if($(window).width() <= 1440 && slideWidth > 963 ) {
bodyAnimateIn['width'] = $body.width(); bodyAnimateIn['width'] = $body.width();
} }
@@ -92,6 +105,7 @@
// Animate the slide, and attach this slide's settings to the element // Animate the slide, and attach this slide's settings to the element
$body.animate(bodyAnimateIn, speed); $body.animate(bodyAnimateIn, speed);
$bottomNav.animate(bottomnavAnimateIn, speed);
$pageslide.show().animate(slideAnimateIn, speed, function() { $pageslide.show().animate(slideAnimateIn, speed, function() {
_sliding = false; _sliding = false;
$pageslide.children('.nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true }); $pageslide.children('.nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
@@ -108,7 +122,7 @@
$.fn.pageslide = function(options) { $.fn.pageslide = function(options) {
var $elements = this; var $elements = this;
// On click // On click
$elements.on(clickEvent, function(e) { $elements.bind(clickEvent, function(e) {
var $self = $(this), var $self = $(this),
settings = $.extend({ href: $self.attr('href') }, options); settings = $.extend({ href: $self.attr('href') }, options);
@@ -121,7 +135,7 @@
$.pageslide.close(); $.pageslide.close();
} else { } else {
// Open // Open
$.pageslide( settings ); $.pageslide( settings,$self );
if($('.item-groups').length) { if($('.item-groups').length) {
$('.item-menu > a, .navbar-inner').removeClass("active"); $('.item-menu > a, .navbar-inner').removeClass("active");
@@ -140,7 +154,16 @@
$pageName = $self.parents('.item-title').children('a').text(); $pageName = $self.parents('.item-title').children('a').text();
$('.page-name').text($pageName); $('.page-name').text($pageName);
} else if($('.tags-groups').length) { } else if($('.tags-groups').length) {
$(this).parents('li').addClass("active").siblings().removeClass("active").parent('ul').siblings().children('li').removeClass("active"); if($('.gallery').length) {
$(this).closest('.rgalbum').addClass('active-single').siblings().removeClass('active-single');
if($(this).closest('ul').hasClass('photo-action')) {
$('.checkbox').prop('checked', false);
$('.rgalbum').removeClass('active');
$('.deletephoto, .deselect, .addtags').addClass('hide');
}
} else {
$(this).closest('li').addClass("active").siblings().removeClass("active").parent('ul').siblings().children('li').removeClass("active");
}
} else { } else {
$(this).parents("tr").addClass("active").siblings().removeClass("active");; $(this).parents("tr").addClass("active").siblings().removeClass("active");;
} }
@@ -151,9 +174,9 @@
}; };
}); });
}; };
/* /*
* Default settings * Default settings
*/ */
$.fn.pageslide.defaults = { $.fn.pageslide.defaults = {
@@ -164,18 +187,18 @@
href: null, // Override the source of the content. Optional in most cases, but required when opening pageslide programmatically. href: null, // Override the source of the content. Optional in most cases, but required when opening pageslide programmatically.
W: 264, W: 264,
closeFn : null, closeFn : null,
openFn : null openFn : null,
loadComplete : null
}; };
/* /*
* Public methods * Public methods
*/ */
// Open the pageslide // Open the pageslide
$.pageslide = function( options ) { $.pageslide = function( options,element ) {
// Extend the settings with those the user has provided // Extend the settings with those the user has provided
var settings = $.extend({}, $.fn.pageslide.defaults, options); var settings = $.extend({}, $.fn.pageslide.defaults, options);
var convertToFunction = function(fn){ var convertToFunction = function(fn){
var x = new Function(); var x = new Function();
x = fn; x = fn;
@@ -190,16 +213,19 @@
if(settings.closeFn) { if(settings.closeFn) {
$.fn.pageslide.defaults.closeFn = convertToFunction(settings.closeFn); $.fn.pageslide.defaults.closeFn = convertToFunction(settings.closeFn);
} }
if(settings.loadComplete) {
// Are we trying to open in different direction? $.fn.pageslide.defaults.loadComplete = convertToFunction(settings.loadComplete);
}
// Are we trying to open in different direction?
if( ($pageslide.is(':visible') && $pageslide.data( 'W' ) != settings.W) || ($pageslide.is(':visible') && $pageslide.data( 'direction' ) != settings.direction) ) { if( ($pageslide.is(':visible') && $pageslide.data( 'W' ) != settings.W) || ($pageslide.is(':visible') && $pageslide.data( 'direction' ) != settings.direction) ) {
$.pageslide.close(function(){ $.pageslide.close(function(){
$pageslide.css({'width': settings.W}); $pageslide.css({'width': settings.W});
_load( settings.href, settings.iframe ); _load( settings.href, settings.iframe, settings.loadComplete, element );
_start( settings.direction, settings.speed ); _start( settings.direction, settings.speed );
}); });
} else { } else {
_load( settings.href, settings.iframe ); _load( settings.href, settings.iframe, settings.loadComplete,element );
if( $pageslide.is(':hidden') ) { if( $pageslide.is(':hidden') ) {
$pageslide.css({'width': settings.W}); $pageslide.css({'width': settings.W});
_start( settings.direction, settings.speed ); _start( settings.direction, settings.speed );
@@ -218,18 +244,19 @@
}; };
}; };
// Close the pageslide // Close the pageslide
$.pageslide.close = function( callback ) { $.pageslide.close = function( callback ) {
var $pageslide = $('#pageslide'), var $pageslide = $('#pageslide'),
slideWidth = $pageslide.outerWidth( true ), slideWidth = $pageslide.outerWidth( true ),
speed = $pageslide.data( 'speed' ), speed = $pageslide.data( 'speed' ),
bodyAnimateIn = {}, bodyAnimateIn = {},
bottomnavAnimateIn = {};
slideAnimateIn = {} slideAnimateIn = {}
// If the slide isn't open, just ignore the call // If the slide isn't open, just ignore the call
if( $pageslide.is(':hidden') || _sliding ) return; if( $pageslide.is(':hidden') || _sliding ) return;
_sliding = true; _sliding = true;
switch( $pageslide.data( 'direction' ) ) { switch( $pageslide.data( 'direction' ) ) {
@@ -239,9 +266,10 @@
break; break;
default: default:
bodyAnimateIn['margin-left'] = '-=' + slideWidth; bodyAnimateIn['margin-left'] = '-=' + slideWidth;
bottomnavAnimateIn['left'] = '-=' + slideWidth;
slideAnimateIn['left'] = '-=' + slideWidth; slideAnimateIn['left'] = '-=' + slideWidth;
if($pageslide.find('.preview').length) { if($pageslide.find('.preview').length) {
// $pageslide.find('.preview').cycle('destroy'); $pageslide.find('.preview').cycle('destroy');
$pageslide.find('.preview img').removeAttr('style'); $pageslide.find('.preview img').removeAttr('style');
} }
break; break;
@@ -257,11 +285,13 @@
} }
} else if($('.tags-groups').length) { } else if($('.tags-groups').length) {
$('.tags-groups').children('li').removeClass("active"); $('.tags-groups').children('li').removeClass("active");
$('.rgalbum').removeClass("active-single");
} else { } else {
$("tr").removeClass("active"); $("tr").removeClass("active");
}; };
$pageslide.animate(slideAnimateIn, speed); $pageslide.animate(slideAnimateIn, speed);
$bottomNav.animate(bottomnavAnimateIn, speed);
$body.animate(bodyAnimateIn, speed, function() { $body.animate(bodyAnimateIn, speed, function() {
$pageslide.hide(); $pageslide.hide();
_sliding = false; _sliding = false;
@@ -287,26 +317,33 @@
$.fn.pageslide.defaults.openFn = callback; $.fn.pageslide.defaults.openFn = callback;
}; };
}; };
/* Events */ //data load complete callback
$.pageslide.loadComplete = function(callback) {
// Don't let clicks to the pageslide close the window if(typeof callback === "function"){
$.fn.pageslide.defaults.loadComplete = callback;
};
};
/* Events */
// Don't let clicks to the pageslide close the window
$pageslide.click(function(e) { $pageslide.click(function(e) {
e.stopPropagation(); e.stopPropagation();
}); });
// Close the pageslide if the document is clicked or the users presses the ESC key, unless the pageslide is modal // Close the pageslide if the document is clicked or the users presses the ESC key, unless the pageslide is modal
$(document).bind('click keyup', function(e) { $(document).bind('click keyup', function(e) {
// If this is a keyup event, let's see if it's an ESC key // If this is a keyup event, let's see if it's an ESC key
if( e.type == "keyup" && e.keyCode != 27) return; if( e.type == "keyup" && e.keyCode != 27) return;
// Make sure it's visible, and we're not modal // Make sure it's visible, and we're not modal
if( $pageslide.is( ':visible' ) && !$pageslide.data( 'modal' ) ) { if( $pageslide.is( ':visible' ) && !$pageslide.data( 'modal' ) ) {
$.pageslide.close(); $.pageslide.close();
} }
}); });
function setScroll(){ function setScroll(){
$pageslide.children('.nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true }); // set nano scroll $pageslide.children('.nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true }); // set nano scroll
}; };
})(jQuery); })(jQuery);
+101
View File
@@ -0,0 +1,101 @@
var ListCheck = function(element) {
this.element = $(element);
this.element.data('exists', true);
if(this.element.context.parentNode.tagName == "TD") {
this.elementWrap = $(this.element.context.parentNode);
this.elementWrap.addClass('listCheck');
} else if(this.element.context.parentNode.tagName == "TH") {
this.elementWrap = $(this.element.context.parentNode);
this.elementWrap.addClass('listCheckHead');
}
this.element.before('<i class="icon-check-empty" />');
};
$.fn.listCheck = function (callback) {
this.each(function (i) {
if(!$(this).data('exists')) {
new ListCheck(this);
};
});
this.on(clickEvent, function(e) {
if($(this).prop('checked')) {
$(this).siblings('i').addClass('icon-check').removeClass('icon-check-empty').closest('tr').addClass('checkHit');
} else {
$(this).siblings('i').addClass('icon-check-empty').removeClass('icon-check').closest('tr').removeClass('checkHit');
};
if ($(this).closest('.listCheckHead').length) {
$('.listCheck .list-check').prop('checked', $(this).prop('checked'));
if($(this).prop('checked')) {
$('.listCheck i').addClass('icon-check').removeClass('icon-check-empty').closest('tr').addClass('checkHit');
} else {
$('.listCheck i').addClass('icon-check-empty').removeClass('icon-check').closest('tr').removeClass('checkHit');
}
};
var _isCheck = $('tbody .list-check').filter(':checked').length,
_defaultLength = $('tbody .list-check').length;
if(_isCheck > 0 && _isCheck < _defaultLength) {
$('.listCheckHead i').removeClass('icon-check-empty icon-check').addClass('icon-minus');
} else if(!_isCheck) {
$('.listCheckHead i').removeClass('icon-minus icon-check').addClass('icon-check-empty');
} else {
$('.listCheckHead i').removeClass('icon-check-empty icon-minus').addClass('icon-check');
}
_isCheck ? $('.list-active-btn').removeClass('disabled').data('actionable', true) : $('.list-active-btn').addClass('disabled').data('actionable', false);
});
};
function clearCheck() {
$('.list-check').each(function() {
$(this).prop('checked', false);
})
}
function actionSuccess(e) {
$("tbody .list-check").each(function() {
switch(e) {
case 'list-be-hide':
$(this).filter(':checked').closest('tr').addClass('checkHide');
break;
case 'list-be-show':
$(this).filter(':checked').closest('tr').removeClass('checkHide');
break;
case 'list-be-remove':
$(this).filter(':checked').closest('tr').fadeOut(300, function() {
$(this).remove();
});
break;
};
$('.list-check').siblings('i').removeAttr('class').addClass('icon-check-empty').closest('tr').removeClass('checkHit');
});
clearCheck();
}
$(function() {
var $t = null,
_data = null;
clearCheck();
$('.list-check').listCheck();
$('.list-active-btn').data('actionable', false).on(clickEvent, function(e) {
$t = $(this)
_data = $(this).data()
_data.actionable ? $('#dialog').modal('show') : "";
e.preventDefault();
});
$('.delete-item').on(clickEvent, function() {
var _v = [];
$("tbody .list-check").each(function() {
this.checked && _v.push("ids[]="+this.value)
});
var _t = $t.attr("rel");
if(_t.indexOf("?") > -1) {
$.ajax(_t + "&" + _v.join("&")).done(function() {
actionSuccess(_data.checkAction)
});
} else {
$.ajax(_t + "?" + _v.join("&")).done(function() {
actionSuccess(_data.checkAction)
});
}
$('#dialog').modal('hide');
$('.list-active-btn').addClass('disabled').data('actionable', false);
});
});
+1 -35
View File
@@ -1,37 +1,3 @@
function loadViewPage(url, id) {
var $listView = $(id);
$listView.empty().removeClass('in active');
$listView.load(url, function(response, status, xhr) {
$(this).addClass('in active');
$('#member-card').imagesLoaded(function() {
$('#member-card .member-avatar img').muImageResize({width: 150, height:150});
});
$('#member-abstract').imagesLoaded(function() {
$('#member-abstract .member-avatar img').muImageResize({width: 250, height:120});
});
})
}
$(function() { $(function() {
$search = window.location.pathname.substring(1); $('.member-avatar').rsImg();
$search = $search.split("/");
$search = $search[$search.length-1];
$viewType = window.localStorage.getItem('viewType') || '#member-list';
$viewSwitchNo = window.localStorage.getItem('viewSwitchNo') || 0;
if($search == 'users-registrant-list.shtml') {
loadViewPage('member-registrant-list.html ' + $viewType, '#list-view');
} else {
loadViewPage('member-list.html ' + $viewType, '#list-view');
};
$('.view-switch').children('.btn').eq($viewSwitchNo).addClass('active');
$('.view-switch').delegate(".btn", 'click', function(e){
var url = $(this).attr('href'),
ID = url.split("#"),
ID = '#' + ID[ID.length-1];
window.localStorage.setItem('viewType', ID);
window.localStorage.setItem('viewSwitchNo', $(this).index());
loadViewPage(url, '#list-view');
e.preventDefault();
});
}) })
+30 -27
View File
@@ -1,3 +1,4 @@
var H,P = [];
// Go to // Go to
!function ($) { !function ($) {
$.fn.goTo = function (){ $.fn.goTo = function (){
@@ -13,43 +14,45 @@
} }
}(window.jQuery); }(window.jQuery);
function checkHeight() { function checkHeight() {
if($('#member-module').height() > $(window).height()) { // if($('#member-module').height() > $(window).height()) {
H = $(window).height()- // H = $(window).height()-
parseInt($('.wrap-inner').css('padding-top'))+ // parseInt($('.wrap-inner').css('padding-top'))+
parseInt($('.wrap-inner').css('padding-bottom'))- // parseInt($('.wrap-inner').css('padding-bottom'))-
$('#orbit-bar').outerHeight(true); // $('#orbit-bar').outerHeight(true);
}else{ // }else{
H = $(window).height()- // H = $(window).height()-
parseInt($('.wrap-inner').css('padding-top'))+ // parseInt($('.wrap-inner').css('padding-top'))+
parseInt($('.wrap-inner').css('padding-bottom'))- // parseInt($('.wrap-inner').css('padding-bottom'))-
$('#filter').outerHeight()+ // $('#filter').outerHeight()+
parseInt($('#filter').css('margin-bottom'))- // parseInt($('#filter').css('margin-bottom'))-
$('#orbit-bar').outerHeight(true); // $('#orbit-bar').outerHeight(true);
}; // };
H = $(window).height()-
parseInt($('.wrap-inner').css('padding-top'))-
$('#orbit-bar').outerHeight(true);
$('#basic-info').height(H); $('#basic-info').height(H);
$('#member-roles').height(H-$('.member-avatar').outerHeight(true)-parseInt($('#member-roles').css('margin-top'))) $('#member-roles').height(H-$('.member-avatar').outerHeight(true)-parseInt($('#member-roles').css('margin-top'))+20);
$('#module-content').height(H-$('#module-navbar .navbar').outerHeight(true)-$('.bottomnav').innerHeight());
}; };
$(function() { $(function() {
var H;
checkHeight(); checkHeight();
$(window).resize(function() { $('.wrap-inner').css('padding-bottom', 0);
checkHeight(); $(window).resize(checkHeight);
// setModuleBlockWidth();
});
$('#member-roles h4 > span').each(function() { $('#member-roles h4 > span').each(function() {
$(this).css('margin-left',function() { $(this).css('margin-left',function() {
return $(this).innerWidth()/2*-1; return $(this).innerWidth()/2*-1;
}) })
}) })
$('#basic-info').scrollToFixed({ // $('#basic-info').scrollToFixed({
marginTop: $('#orbit-bar').outerHeight(true)+20, // marginTop: $('#orbit-bar').outerHeight(true)+20,
}); // });
$('#module-navbar').scrollToFixed({ // $('#module-navbar').scrollToFixed({
marginTop: $('#orbit-bar').outerHeight(true), // marginTop: $('#orbit-bar').outerHeight(true),
}); // });
// $('.member-avatar').imagesLoaded(function() { // $('.member-avatar').imagesLoaded(function() {
// $('#basic-info .member-avatar img').muImageResize({width: 100, height:100}); // $('#basic-info .member-avatar img').muImageResize({width: 100, height:100});
// }); // });
$('#member-roles').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true }); $('.member-avatar').rsImg();
}) $('#member-roles, #module-content .nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
});
@@ -191,12 +191,17 @@ function returnAddressForm(element, decide) {
$(function() { $(function() {
appendIndex = null; appendIndex = null;
if($('#new-user-forms').length) { if($('#user-forms').length) {
addressVal = []; addressVal = [];
addressArray = []; addressArray = [];
addressInputId = []; addressInputId = [];
roleType = null; roleType = null;
returnDecide = false; returnDecide = false;
$('.attributes').each(function() {
if($(this).find('.toggle-check').attr('value') == "true") {
$(this).addClass('disabled').children('.attributes-body').hide();
}
});
$('.returnDecide').on(clickEvent, function() { $('.returnDecide').on(clickEvent, function() {
returnDecide = true; returnDecide = true;
}) })
@@ -215,21 +220,21 @@ $(function() {
}); });
$('#address-field').on('show', getAddressForm($trigger, $('#address-field'), true)); $('#address-field').on('show', getAddressForm($trigger, $('#address-field'), true));
}); });
$('#new-user-forms').delegate('.togglebox, .delete, .trigger, .remove-input', clickEvent, function(event) { $('#user-forms').delegate('.togglebox, .delete, .trigger, .remove-input', clickEvent, function(event) {
if($(this).hasClass('togglebox')) { if($(this).hasClass('togglebox')) {
if($(this).hasClass('disabled')) { if($(this).hasClass('disabled')) {
$(this).find('.toggle-check') $(this).find('.toggle-check')
.attr('value', 'false') .attr('value', 'false')
.closest('.attributes') .closest('.attributes')
.removeClass('disabled') .removeClass('disabled')
.find('.attributes-body') .children('.attributes-body')
.fadeIn(300); .fadeIn(300);
} else { } else {
$(this).find('.toggle-check') $(this).find('.toggle-check')
.attr('value', 'true') .attr('value', 'true')
.closest('.attributes') .closest('.attributes')
.addClass('disabled') .addClass('disabled')
.find('.attributes-body') .children('.attributes-body')
.fadeOut(300); .fadeOut(300);
} }
$(this).toggleClass('disabled'); $(this).toggleClass('disabled');
@@ -422,12 +427,13 @@ $(function() {
if($(this).hasClass('trigger')) { if($(this).hasClass('trigger')) {
// appendIndex = $(this).closest('.controls').find('.input-append').length; // appendIndex = $(this).closest('.controls').find('.input-append').length;
appendIndex = $(this).closest('.controls').find('.input-append:last-child').children('input:first-child').attr('name'); appendIndex = $(this).closest('.controls').find('.input-append:last-child').children('input:first-child').attr('name');
appendIndex = appendIndex.split("]["); // appendIndex = appendIndex.split("][");
appendIndex = parseInt(appendIndex[appendIndex.length-2])+1; // appendIndex = parseInt(appendIndex[appendIndex.length-2])+1;
appendIndex = parseInt(appendIndex.match(/[^[\D\]]+(?=])/g)[1])+1;
console.log(appendIndex)
attributeIndex = $(this).closest('.attributes').index(); attributeIndex = $(this).closest('.attributes').index();
templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref'); templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref');
$("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target')); $("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target'));
inputAppendLength(); inputAppendLength();
}; };
if($(this).hasClass('remove-input')) { if($(this).hasClass('remove-input')) {
@@ -0,0 +1,56 @@
function dragMode() {
$('#card-list').sortable({
placeholder: "highlight",
update: function( event, ui ) {
var _userPosition = {};
_userPosition.position = $(ui.item).index();
_userPosition.id = $(ui.item).data('user-id');
$.ajax({
url: "<%= Rails.application.routes.url_helpers.update_order_card_admin_users_new_interface_index_path %>",
type: 'POST',
dataType: 'script',
data: {users: _userPosition}
});
}
});
$('#card-list').disableSelection();
}
function typeMode() {
var _userPosition = [];
$('#list-view tbody tr').each(function(i) {
$(this).data('user-index', i);
});
$('#member-list').on(clickEvent, '.edit_position', function(e){
var $input = $('<input type="text">'),
$cross = $('<a class="btn btn-mini"><i class="icons-cross"/></a>');
if($(this).siblings('input').length) {
$(this).siblings('input').attr('type', 'text').after($cross);
} else {
$(this).after($cross);
$(this).after($input);
}
$(this).hide();
$input.val($(this).text());
e.preventDefault();
$cross.click(function(event) {
$input.remove();
$(this).siblings('a').show().end().remove();
});
});
$('.bottomnav').on(clickEvent, '.btn', function(e) {
_userPosition = [];
$('#member-list tbody input').each(function(i) {
_userPosition.push([$(this).val(), $(this).siblings('a').data('user-id')]);
});
$.ajax({
url: "<%= Rails.application.routes.url_helpers.update_order_list_admin_users_new_interface_index_path %>",
type: 'POST',
dataType: 'script',
data: {users: _userPosition}
});
e.preventDefault();
});
};
@@ -1,4 +1,4 @@
$(function() { function textareaResizable() {
var $btnW = null, var $btnW = null,
$textareaLangBtnGroup = $('.textarea-lang > .btn-group'), $textareaLangBtnGroup = $('.textarea-lang > .btn-group'),
$textareaLang = $('.textarea-lang'), $textareaLang = $('.textarea-lang'),
@@ -8,12 +8,12 @@ $(function() {
$btnW = 4 $btnW = 4
$(this).find('.btn').each(function() { $(this).find('.btn').each(function() {
$btnW += $(this).outerWidth(true); $btnW += $(this).outerWidth(true);
$(this).on('click', function() { $(this).on(clickEvent, function() {
var $id = $($(this).attr('href')); var $id = $($(this).attr('href'));
if($id.find('.ui-wrapper').height() < 96) { if($id.find('.ui-wrapper').height() < 96) {
$id.find('.ui-wrapper').height(96) $id.find('.ui-wrapper').height(96)
} };
}) });
}); });
}); });
$textarea.each(function() { $textarea.each(function() {
@@ -26,4 +26,7 @@ $(function() {
minWidth: $btnW+114, minWidth: $btnW+114,
handles: "se", handles: "se",
}); });
};
$(function() {
textareaResizable();
}); });
@@ -0,0 +1,8 @@
$(function() {
$('.module-area [data-toggle=buttons-checkbox]').find('input[type="checkbox"]').each(function() {
$(this).prop('checked') ? $(this).siblings('input[type="hidden"]').val(1) : $(this).siblings('input[type="hidden"]').val(0);
});
$('.module-area').delegate('input[type="checkbox"]', clickEvent, function(event) {
$(this).prop('checked') ? $(this).siblings('input[type="hidden"]').val(1) : $(this).siblings('input[type="hidden"]').val(0);
});
});
+1 -1
View File
@@ -4,4 +4,4 @@
//= require basic/bootstrap //= require basic/bootstrap
//= require kernel //= require kernel
//= require lib/jquery.preload-min.js //= require lib/jquery.preload-min.js
//= require lib/jquery.cycle.all.latest.js //= require lib/jquery.cycle.all.js
+1 -1
View File
@@ -1,5 +1,5 @@
//= require basic //= require basic
//= require lib/jquery-ui-1.10.2.custom.min.js //= require jquery.ui.sortable
//= require lib/jquery.ui.touch-punch.min.js //= require lib/jquery.ui.touch-punch.min.js
//= require lib/jquery.mjs.nestedSortable.js //= require lib/jquery.mjs.nestedSortable.js
//= require lib/items/items //= require lib/items/items
+158 -29
View File
@@ -83,6 +83,7 @@ legend {
min-width: 61px; min-width: 61px;
z-index: 1030; z-index: 1030;
position: fixed; position: fixed;
padding-top: 40px;
background-color: #171717; background-color: #171717;
-webkit-box-shadow: inset -1px 0px 10px #000000; -webkit-box-shadow: inset -1px 0px 10px #000000;
-moz-box-shadow: inset -1px 0px 10px #000000; -moz-box-shadow: inset -1px 0px 10px #000000;
@@ -91,12 +92,14 @@ legend {
} }
#sidebar #sidebar-menu { #sidebar #sidebar-menu {
position: absolute; position: absolute;
top: 88px; top: 85px;
bottom: 0; bottom: 0;
z-index: 1; z-index: 0;
display: block; display: block;
width: 61px; width: 61px;
/*overflow: auto;*/ }
#sidebar #sidebar-menu.nano {
top: 0;
} }
#sidebar .scroller { #sidebar .scroller {
position: absolute; position: absolute;
@@ -120,16 +123,12 @@ legend {
list-style: none; list-style: none;
} }
#sidebar > h2.position { #sidebar > h2.position {
top: 40px;
margin: 0; margin: 0;
width: 61px; width: 61px;
color: #FFFFFF; color: #FFFFFF;
font-weight: normal; font-weight: normal;
font-size: 2.4em;
line-height: 47px;
line-height: 46px\9;
text-align: center; text-align: center;
position: absolute; position: relative;
background-color: #08c; background-color: #08c;
background-image: -moz-linear-gradient(top, #08c, #006091); background-image: -moz-linear-gradient(top, #08c, #006091);
background-image: -ms-linear-gradient(top, #08c, #006091); background-image: -ms-linear-gradient(top, #08c, #006091);
@@ -158,24 +157,20 @@ legend {
} }
#sidebar > h2.position a { #sidebar > h2.position a {
color: #FFFFFF; color: #FFFFFF;
padding: 6px 6px 5px;
text-decoration: none; text-decoration: none;
display: inline-block;
-webkit-text-shadow: 0px -1px 0px #333333; -webkit-text-shadow: 0px -1px 0px #333333;
-moz-text-shadow: 0px -1px 0px #333333; -moz-text-shadow: 0px -1px 0px #333333;
-o-text-shadow: 0px -1px 0px #333333; -o-text-shadow: 0px -1px 0px #333333;
text-shadow: 0px -1px 0px #333333; text-shadow: 0px -1px 0px #333333;
} }
#sidebar > h2.position a i {
line-height: 45px;
}
#sidebar .sidebar-nav > li { #sidebar .sidebar-nav > li {
min-width: 61px; min-width: 61px;
height: 45px;
} }
#sidebar .sidebar-nav > li.active { #sidebar .sidebar-nav > li.active span {
font-size: 1.2em;
}
#sidebar .sidebar-nav > li.active .sub-nav-block {
display: block;
}
#sidebar .sidebar-nav > li.active > a > span {
color: #FFFFFF; color: #FFFFFF;
cursor: pointer; cursor: pointer;
-webkit-text-shadow: 0px -1px 0px #636363; -webkit-text-shadow: 0px -1px 0px #636363;
@@ -183,8 +178,7 @@ legend {
-o-text-shadow: 0px -1px 0px #636363; -o-text-shadow: 0px -1px 0px #636363;
text-shadow: 0px -1px 0px #636363; text-shadow: 0px -1px 0px #636363;
} }
#sidebar .sidebar-nav > li > a > span { #sidebar .sidebar-nav > li span {
padding: 10px;
color: #B0B0B0; color: #B0B0B0;
display: block; display: block;
-webkit-text-shadow: 0px 1px 0px #000000; -webkit-text-shadow: 0px 1px 0px #000000;
@@ -192,8 +186,15 @@ legend {
-o-text-shadow: 0px 1px 0px #000000; -o-text-shadow: 0px 1px 0px #000000;
text-shadow: 0px 1px 0px #000000; text-shadow: 0px 1px 0px #000000;
} }
#sidebar .sidebar-nav > li > a > span > i { #sidebar .sidebar-nav > li a {
font-size: 1.7em; display: block;
}
#sidebar .sidebar-nav > li i {
font-size: 1.6em;
line-height: 45px;
}
#sidebar .sidebar-nav > li.active i {
font-size: 2.2em;
} }
#sidebar .sub-nav-block-list { #sidebar .sub-nav-block-list {
top: 40px; top: 40px;
@@ -274,7 +275,7 @@ legend {
} }
#sidebar .sub-nav-arrow { #sidebar .sub-nav-arrow {
left: 53px; left: 53px;
top: -10px; top: -16px;
width: 0px; width: 0px;
height: 0px; height: 0px;
z-index: -1; z-index: -1;
@@ -282,7 +283,6 @@ legend {
border-style: solid; border-style: solid;
border-width: 8px 8px 8px 0; border-width: 8px 8px 8px 0;
border-color: transparent #0088CC transparent transparent; border-color: transparent #0088CC transparent transparent;
display: none\9; /* 用IE的去死 */
} }
@@ -300,14 +300,15 @@ legend {
position: absolute; position: absolute;
z-index: 100; z-index: 100;
width: 100%; width: 100%;
border-radius: 1px; border-radius: 50%/1px;
background-color: rgba(0, 136, 204, .3); background-color: rgba(0, 136, 204, .6);
} }
/* Main Wrap */ /* Main Wrap */
#main-wrap { #main-wrap {
padding-top: 40px; padding-top: 40px;
position: relative;
} }
#main-wrap .wrap-inner { #main-wrap .wrap-inner {
padding: 60px 20px 20px; padding: 60px 20px 20px;
@@ -419,6 +420,7 @@ legend {
/* Search Clear */ /* Search Clear */
.searchClear { .searchClear {
position: relative; position: relative;
display: inline-block;
} }
.searchClear .icon-search { .searchClear .icon-search {
position: absolute; position: absolute;
@@ -520,10 +522,9 @@ legend {
padding: 0px 5px; padding: 0px 5px;
position: absolute; position: absolute;
z-index: 9999; z-index: 9999;
max-width: 500px; max-width: 300px;
border-radius: 3px; border-radius: 3px;
background-color: #0088CC; background-color: #0088CC;
white-space: nowrap;
} }
#sideset .ui-tooltip.sidebar-tooltip:after { #sideset .ui-tooltip.sidebar-tooltip:after {
display: none; display: none;
@@ -533,10 +534,9 @@ legend {
padding: 0px 5px; padding: 0px 5px;
position: absolute; position: absolute;
z-index: 9999; z-index: 9999;
max-width: 500px; max-width: 300px;
border-radius: 3px; border-radius: 3px;
background-color: #000000; background-color: #000000;
white-space: nowrap;
} }
.ui-tooltip:after { .ui-tooltip:after {
content: ''; content: '';
@@ -551,6 +551,135 @@ legend {
border-color: #000000 transparent transparent transparent; border-color: #000000 transparent transparent transparent;
} }
/* Sign In */
#sign-in {
background-color: #F3F3F3;
background-repeat: no-repeat;
background : -webkit-radial-gradient(center center,circle cover, #F3F3F3 10%, #DBDBDB 100%);
background : -moz-radial-gradient(center center,circle cover, #F3F3F3 10%, #DBDBDB 100%);
background : -o-radial-gradient(center center,circle cover, #F3F3F3 10%, #DBDBDB 100%);
background : -ms-radial-gradient(center center,circle cover, #F3F3F3 10%, #DBDBDB 100%);
background : -radial-gradient(center center,circle cover, #F3F3F3 10%, #DBDBDB 100%);
}
.sign-in {
text-align: center;
position: relative;
width: 300px;
margin: 150px auto 0;
}
.sign-in .other-sign-in {
display: none;
}
.sign-in .login-logo {
margin: 0;
padding-bottom: 15px;
border-bottom: 1px solid #ededed;
}
.sign-in .alert {
box-shadow: 0 3px 10px #CBCBCB;
text-align: left;
}
.sign-in .form {
background-color: #FFF;
box-shadow: 0 10px 20px #CBCBCB;
padding: 15px;
margin-bottom: 20px;
}
.sign-in .form-block {
overflow: hidden;
}
.sign-in .form-list {
width: 555px;
}
.sign-in .content {
float: left;
margin-bottom: 0;
position: relative;
}
.sign-in .content + .content {
margin-left: 15px;
}
.sign-in .control-group {
position: relative;
width: 270px;
margin: 0;
}
.sign-in .control-group label {
position: absolute;
top: 0;
left: 0;
width: 39px;
height: 40px;
line-height: 40px;
margin: 0;
color: #5C5C5C;
}
.sign-in .control-group input {
width: 222px;
height: 30px;
padding: 4px 6px 4px 40px;
margin-bottom: 25px;
}
.sign-in .btn {
padding: 4px 0;
display: block;
width: 100%;
margin-bottom: 10px;
}
.sign-in .other-sign-in {
position: relative;
margin-top: 20px;
margin-bottom: 30px;
padding-bottom: 20px;
border-bottom: 1px solid #ededed;
}
.sign-in .other-sign-in p {
position: absolute;
width: 30px;
height: 30px;
background-color: #FFF;
padding: 0 10px;
margin-bottom: 0;
margin-left: -25px;
line-height: 30px;
left: 50%;
bottom: -15px;
font-size: 1.3em;
color: #b1b1b1;
}
.sign-in .checkbox {
position: absolute;
text-align: left;
bottom: 37px;
}
.sign-in .switchboard {
color: #08C;
cursor: pointer;
}
.sign-in .switchboard span,
.sign-in .switchboard.active i {
display: inline;
}
.sign-in .switchboard.active span,
.sign-in .switchboard i {
display: none;
}
.register {
box-shadow: inset 0 5px 5px #E0E0E0;
background-color: #eee;
padding: 15px;
margin: 15px -15px -15px;
}
.register .btn {
margin: 0;
}
.have-other-sign-in {
margin: 80px auto 0;
}
.have-other-sign-in .other-sign-in {
display: block;
}
/* IE go die */ /* IE go die */
:root #sidebar .sub-nav-block:before { :root #sidebar .sub-nav-block:before {
display: block\9; display: block\9;
@@ -19,6 +19,18 @@
margin-left: 0; margin-left: 0;
} }
} }
.form_fix {
textarea {
margin-bottom: 12px;
}
input[type="text"] {
margin-left: 0;
margin-top: 0;
}
input[type="text"] + input {
margin-top: 12px;
}
}
// fixed width column with 12px gutter // fixed width column with 12px gutter
// 276px width for 8 columns // 276px width for 8 columns
// 420px width for 12 columns // 420px width for 12 columns
@@ -323,6 +323,29 @@ a.admtxt.admbg2:hover {
float: left; } float: left; }
.docklist .d_cate:hover .dock_child { .docklist .d_cate:hover .dock_child {
display: block; } display: block; }
.disable {
opacity: .3;
}
.disable a {
cursor: not-allowed;
}
.private {
position: relative;
padding-right: 10px;
width: 300px;
opacity: .3 !important;
}
.private:after {
content: "\e073";
display: inline-block;
font-family: 'entypo';
font-size: 1.5em;
position: absolute;
right: 0;
text-align: center;
text-decoration: inherit;
top: 5px;
}
.fn_des.admtxt { .fn_des.admtxt {
line-height: 60px; line-height: 60px;
@@ -714,7 +737,8 @@ a.admtxt.admbg2:hover {
/* list item */ /* list item */
.list_t_item { .list_t_item {
overflow: hidden; } overflow: hidden;
height: 100px; }
.list_t_title { .list_t_title {
padding-bottom: 6px; padding-bottom: 6px;
@@ -748,7 +772,8 @@ a.admtxt.admbg2:hover {
-webkit-text-size-adjust: none; } -webkit-text-size-adjust: none; }
.list_item_function a :first-child { .list_item_function a :first-child {
margin-left: 0; } margin-left: 0; }
.datalist_item:hover .list_item_function { .datalist_item:hover .list_item_function,
.list_t_item:hover .list_item_function {
bottom: 0; } bottom: 0; }
/* App */ /* App */
@@ -125,6 +125,14 @@
} }
#list-view .checkbox-card li {
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
}
/* Responsive */ /* Responsive */
@media (max-width: 767px) { @media (max-width: 767px) {
@@ -0,0 +1,52 @@
/* Based on the theme at http://bonsaiden.github.com/JavaScript-Garden */
/*<!--breakpoint-->*/
.breakpoints {width: .8em;}
.breakpoint { color: #822; }
/*<!--match-->*/
span.CodeMirror-matchhighlight { background: #494949 }
.CodeMirror-focused span.CodeMirror-matchhighlight { background: #314D67 !important; }
/*<!--activeline-->*/
.activeline {background: #253540 !important;}
.cm-s-midnight.CodeMirror {
background: #0F192A;
color: #D1EDFF;
}
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
.cm-s-midnight div.CodeMirror-selected {background: #314D67 !important;}
.cm-s-midnight .CodeMirror-gutters {background: #0F192A; border-right: 1px solid;}
.cm-s-midnight .CodeMirror-linenumber {color: #D0D0D0;}
.cm-s-midnight .CodeMirror-cursor {
border-left: 1px solid #F8F8F0 !important;
}
.cm-s-midnight span.cm-comment {color: #428BDD;}
.cm-s-midnight span.cm-atom {color: #AE81FF;}
.cm-s-midnight span.cm-number {color: #D1EDFF;}
.cm-s-midnight span.cm-property, .cm-s-tropicaleve span.cm-attribute {color: #A6E22E;}
.cm-s-midnight span.cm-keyword {color: #E83737;}
.cm-s-midnight span.cm-string {color: #1DC116;}
.cm-s-midnight span.cm-variable {color: #FFAA3E;}
.cm-s-midnight span.cm-variable-2 {color: #FFAA3E;}
.cm-s-midnight span.cm-def {color: #4DD;}
.cm-s-midnight span.cm-error {background: #F92672; color: #F8F8F0;}
.cm-s-midnight span.cm-bracket {color: #D1EDFF;}
.cm-s-midnight span.cm-tag {color: #008;}
.cm-s-midnight span.cm-link {color: #AE81FF;}
.cm-s-midnight .CodeMirror-matchingbracket {
text-decoration: underline;
color: white !important;
}
.typ { color: #FFAA3E; }
.atn { color: #606; }
.atv { color: #080; }
.dec { color: #606; }
+20 -18
View File
@@ -1,21 +1,23 @@
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/ambiance-mobile.css); /*
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/ambiance.css); *= require 'lib/codemirror/theme/ambiance-mobile'
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/blackboard.css); *= require "lib/codemirror/theme/ambiance"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/cobalt.css); *= require "lib/codemirror/theme/blackboard"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/eclipse.css); *= require "lib/codemirror/theme/cobalt"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/elegant.css); *= require "lib/codemirror/theme/eclipse"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/erlang-dark.css); *= require "lib/codemirror/theme/elegant"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/midnight.css); *= require "lib/codemirror/theme/erlang-dark"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/monokai.css); *= require "lib/codemirror/theme/midnight"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/neat.css); *= require "lib/codemirror/theme/monokai"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/night.css); *= require "lib/codemirror/theme/neat"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/rubyblue.css); *= require "lib/codemirror/theme/night"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/solarized.css); *= require "lib/codemirror/theme/rubyblue"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/theme.css); *= require "lib/codemirror/theme/solarized"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/twilight.css); *= require "lib/codemirror/theme/theme"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/vibrant-ink.css); *= require "lib/codemirror/theme/twilight"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/xq-dark.css); *= require "lib/codemirror/theme/vibrant-ink"
@import url(/orbit_4.0.1/assets/stylesheets/lib/codemirror/theme/xq-light.css); *= require "lib/codemirror/theme/xq-dark"
*= require "lib/codemirror/theme/xq-light"
*/
.cm-tab { .cm-tab {
border-left: 1px solid rgba(200, 200, 200, .2); border-left: 1px solid rgba(200, 200, 200, .2);
} }
+28
View File
@@ -0,0 +1,28 @@
.table .listCheckHead,
.table .listCheck {
width: 30px;
vertical-align: middle;
padding: 0 0 0 10px!important;
}
.listCheckHead .list-check,
.listCheck .list-check {
position: absolute;
margin: -12px 0 0 -1px;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0;
}
.listCheckHead i,
.listCheck i {
display: block;
}
.checkHide td {
background-color: #E6E6E6 !important;
color: #B9B9B9;
}
.checkHide a {
color: #B9B9B9;
}
.checkHit td {
background-color: #FFFEDB !important;
}
+13 -2
View File
@@ -280,6 +280,17 @@
line-height: 26px; line-height: 26px;
margin: 0; margin: 0;
} }
.main-forms .attributes-header h4 b {
padding: 0 1px;
border-style: dotted;
border-width: 0 2px;
border-color: #AAA;
margin-right: 5px;
cursor: move;
}
.main-forms .attributes-header h4 i {
cursor: pointer;
}
.main-forms .field-type { .main-forms .field-type {
background-color: #f5f5f5; background-color: #f5f5f5;
border-radius: 5px; border-radius: 5px;
@@ -307,7 +318,7 @@
.main-forms .field-type .control-group:last-child { .main-forms .field-type .control-group:last-child {
margin-bottom: 10px; margin-bottom: 10px;
} }
#new-user-forms .control-group .add-target .input-append, #user-forms .control-group .add-target .input-append,
.main-forms .field-type .control-group .add-target .input-append { .main-forms .field-type .control-group .add-target .input-append {
display: block; display: block;
margin-bottom: 10px; margin-bottom: 10px;
@@ -324,7 +335,7 @@
border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0;
} }
#new-user-forms .control-group .add-target .input-append input.last { #user-forms .control-group .add-target .input-append input.last {
border-radius: 4px; border-radius: 4px;
} }
-193
View File
@@ -1,193 +0,0 @@
/* Main List */
.main-list {
margin-bottom: 10px;
}
.main-list tbody {
border: 1px solid #dddddd;
}
.main-list thead {
border: 1px solid #454545;
}
.main-list thead th {
vertical-align: middle;
background-color: #454545;
white-space: nowrap;
color: #FFFFFF;
}
.main-list tbody tr.disable td {
color: #C5C5C5;
background-color: #eeeeee;
}
.main-list tbody tr.disable td .label-info {
background-color: #999999;
}
.main-list tbody tr.active td:first-child {
position: relative;
}
.main-list tbody tr.active td:first-child:before {
content: "";
width: 0px;
height: 0px;
left: -21px;
top: 50%;
margin-top: -6px;
position: absolute;
border-style: solid;
border-width: 6px 0 6px 6px;
border-color: transparent transparent transparent #333333;
}
.main-list td {
background-color: #FFFFFF;
}
.main-list td.action {
vertical-align: middle;
text-align: right;
}
.main-list td.preview img {
width: 100%;
}
.main-list td .banner-link {
width: 100px;
max-width: 120px;
display: inline-block;
text-overflow: ellipsis;
overflow: hidden;
}
.main-list td .file-list {
display: inline-block;
margin: 0 0 -6px;
}
.main-list td .file-list:after {
content: "";
clear: both;
display: block;
height: 0;
visibility: hidden;
}
.main-list td .file-type {
position: relative;
list-style: none;
float: left;
display: inline-block;
}
.main-list td .file-type a {
background-color: #A6A6A6;
color: #FFFFFF;
margin-right: 10px;
padding: 2px 5px 2px 3px;
border-radius: 3px;
text-decoration: none;
text-shadow: 0px -1px 0px rgba(100, 100, 100, .6);
}
.main-list td .file-type i,
.main-forms fieldset .input-area .controls .file-type i {
width: 16px;
height: 16px;
margin-bottom: -1px;
display: inline-block;
}
.main-list td .file-type[class^="type-"] i,
.main-list td .file-type[class*=" type-"] i,
.main-forms fieldset .input-area .controls .file-type[class*=" type-"] i,
.main-forms fieldset .input-area .controls .file-type[class^="type-"] i {
background-image: url(/orbit_4.0.1/assets/images/file_type.png);
}
.file-type.type-pdf i {background-position: 0px 0px;}
.file-type.type-psd i {background-position: -16px 0px;}
.file-type.type-ai i {background-position: -32px 0px;}
.file-type.type-fla i {background-position: -48px 0px;}
.file-type.type-in i {background-position: -64px 0px;}
.file-type.type-acc i {background-position: 0px -16px;}
.file-type.type-do i {background-position: -16px -16px;}
.file-type.type-xl i {background-position: -32px -16px;}
.file-type.type-pp i {background-position: -48px -16px;}
.file-type.type-zip i {background-position: -64px -16px;}
.file-type.type-txt i {background-position: 0px -32px;}
.file-type.type-jp i {background-position: -16px -32px;}
.file-type.type-gif i {background-position: -32px -32px;}
.file-type.type-png i {background-position: -48px -32px;}
.file-type.type-audio i {background-position: -64px -32px;}
.main-list td .quick-edit {
height: 24px;
margin-top: 5px;
}
.main-list td .quick-edit .nav {
display: none;
margin-bottom: 0;
}
.main-list tr:hover .quick-edit .nav {
display: block;
}
.main-list td .quick-edit .nav > li > a {
padding-top: 4px;
padding-bottom: 4px;
margin-top: 0px;
margin-bottom: 0px;
border: 1px dotted #d1d1d1;
}
.main-list td .quick-edit .nav > li > a:hover {
border: 1px dotted transparent;
}
.main-list thead tr.sort-header th a {
padding: 8px;
margin: -8px;
display: block;
color: #FFFFFF;
text-decoration: none;
}
.main-list thead tr.sort-header th.active a {
padding-bottom: 4px;
border-bottom: 4px solid #08c;
}
.main-list .footable-row-detail td {
padding: 0;
border-top: none;
}
.main-list .footable-row-detail td .footable-row-detail-inner {
display: none;
padding: 8px;
position: relative;
border-radius: 5px;
margin: 0 8px 8px;
background-color: #ededed;
}
.main-list .footable-row-detail td .footable-row-detail-inner:after {
display: block;
height: 0px;
width: 0px;
position: absolute;
top: -6px;
left: 50%;
margin-left: -3px;
content: "";
border-style: solid;
border-width: 0 6px 6px 6px;
border-color: transparent transparent #ededed transparent;
}
.main-list .footable-row-detail td .footable-row-detail-inner div {
margin: 10px 0;
}
#preview .preview {
margin: 0 auto;
}
/* For Retina */
@media screen and (-webkit-min-device-pixel-ratio: 2), screen and (max--moz-device-pixel-ratio: 2) {
.main-list td .file-type[class^="type-"] i,
.main-list td .file-type[class*=" type-"] i,
.main-forms fieldset .input-area .controls .file-type[class*=" type-"] i,
.main-forms fieldset .input-area .controls .file-type[class^="type-"] i {
background-image: url(/orbit_4.0.1/assets/images/file_type@2x.png);
background-size: 80px 48px;
}
}
/* Responsive */
@media (max-width: 480px) {
.main-list td .quick-edit .nav {
display: block;
}
}
@@ -39,6 +39,13 @@
.main-list td { .main-list td {
background-color: #FFFFFF; background-color: #FFFFFF;
} }
.main-list td input[type="text"] {
margin-bottom: 0;
margin-left: -.4em;
margin-right: 3px;
padding: 0 .3em;
width: 4em;
}
.main-list td.action { .main-list td.action {
vertical-align: middle; vertical-align: middle;
text-align: right; text-align: right;
+95 -30
View File
@@ -2,9 +2,20 @@
#list-view h4 a { #list-view h4 a {
color: #000; color: #000;
text-decoration: none; text-decoration: none;
display: block;
width: 100%;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
} }
/* List */ /* List */
#list-view #member-list tr.highlight td {
background-color: #FFFAE5;
}
#list-view #member-list tr.highlight td:first-child {
padding: 0
}
#list-view #member-list .gender, #list-view #member-list .gender,
#list-view #member-list td[class^="gender-"] { #list-view #member-list td[class^="gender-"] {
width: 5px; width: 5px;
@@ -106,10 +117,31 @@
#list-view #member-abstract .member-avatar .action > a.trash { #list-view #member-abstract .member-avatar .action > a.trash {
background-color: #b94a48; background-color: #b94a48;
} }
#list-view #member-abstract .member-avatar > span { /*#list-view #member-abstract .member-avatar:after {
content: "";
position: absolute; position: absolute;
width: 250px; top: 0;
height: 120px; left: 0;
right: 0;
bottom: 0;
display: block;
margin: 0;
background-color: #000000;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
}*/
#list-view #member-abstract > li .member-avatar:after {
-webkit-backface-visibility: hidden;
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: block; display: block;
margin: 0; margin: 0;
background-color: #000000; background-color: #000000;
@@ -120,7 +152,8 @@
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0); filter: alpha(opacity=0);
} }
#list-view #member-abstract > li:hover .member-avatar > span { #list-view #member-abstract > li:hover .member-avatar:after {
-webkit-backface-visibility: hidden;
opacity: .4; opacity: .4;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)"; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
filter: alpha(opacity=40); filter: alpha(opacity=40);
@@ -159,14 +192,13 @@
float: left; float: left;
position: relative; position: relative;
} }
#list-view #member-card > li:hover .member-avatar > span {
opacity: 0.4;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
filter: alpha(opacity=40);
}
#list-view #member-card > li:hover .member-avatar .action { #list-view #member-card > li:hover .member-avatar .action {
visibility: visible; visibility: visible;
} }
#list-view #member-card .highlight {
background-color: #F0F0F0;
outline: 1px dashed #9E9E9E;
}
#list-view #member-card .member-avatar { #list-view #member-card .member-avatar {
width: 150px; width: 150px;
height: 150px; height: 150px;
@@ -183,14 +215,37 @@
#list-view #member-card .member-avatar.gender-woman { #list-view #member-card .member-avatar.gender-woman {
border-color: #FF3196; border-color: #FF3196;
} }
#list-view #member-card .member-avatar.gender-none { #list-view #member-card .member-avatar.gender-nene {
border-color: #DDDDDD; border-color: #DDDDDD;
} }
#list-view #member-card .member-avatar img { #list-view #member-card .member-avatar img {
/*width: 100%;*/ /*width: 100%;*/
max-width: none; max-width: none;
} }
#list-view #member-card .member-avatar > span { #list-view #member-card > li .member-avatar:after {
-webkit-backface-visibility: hidden;
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: block;
margin: 0;
background-color: #000000;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
}
#list-view #member-card > li:hover .member-avatar:after {
opacity: .4;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
filter: alpha(opacity=40);
}
/*#list-view #member-card .member-avatar > span {
position: absolute; position: absolute;
width: 150px; width: 150px;
height: 150px; height: 150px;
@@ -203,7 +258,7 @@
opacity: 0; opacity: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0); filter: alpha(opacity=0);
} }*/
#list-view #member-card .member-avatar .action { #list-view #member-card .member-avatar .action {
position: absolute; position: absolute;
z-index: 1; z-index: 1;
@@ -262,22 +317,25 @@
margin-top: 20px; margin-top: 20px;
} }
#profile #basic-info .member-avatar { #profile #basic-info .member-avatar {
width: 106px; width: 103px;
height: 106px; height: 103px;
float: left; float: left;
}
#profile #basic-info .member-avatar img {
border: 3px solid #ffffff; border: 3px solid #ffffff;
width: 100%; -webkit-border-radius: 9px;
max-width: none; -moz-border-radius: 9px;
border-radius: 9px;
} }
#profile #basic-info .member-avatar.gender-man img { #profile #basic-info .member-avatar:after {
content: "";
-webkit-backface-visibility: hidden;
}
#profile #basic-info .member-avatar.gender-man {
border-color: #34ADFF; border-color: #34ADFF;
} }
#profile #basic-info .member-avatar.gender-woman img { #profile #basic-info .member-avatar.gender-woman {
border-color: #FF3196; border-color: #FF3196;
} }
#profile #basic-info .member-avatar.gender-none img { #profile #basic-info .member-avatar.gender-none {
border-color: #DDDDDD; border-color: #DDDDDD;
} }
#profile #member-roles { #profile #member-roles {
@@ -313,20 +371,27 @@
#profile #member-roles .roles dd { #profile #member-roles .roles dd {
color: #999999; color: #999999;
} }
#profile #module-navbar {
margin-left: 10px;
}
#profile #module-navbar .navbar {
margin-bottom: 15px;
}
#profile #member-module { #profile #member-module {
margin-left: 360px; margin-left: 360px;
} }
#profile #member-module #module-navbar.scroll-to-fixed-fixed {
background-color: #F3F3F3;
padding-top: 20px;
}
#profile #member-module #module-navbar.scroll-to-fixed-fixed .navbar {
margin-bottom: 10px;
}
#profile #member-module #module-content { #profile #member-module #module-content {
padding: 0 10px; padding: 0 0 0 10px;
}
#profile #member-module #module-content .content {
right: 10px;
padding-bottom: 10px;
outline: none;
}
#profile #member-module #module-content .list-active {
padding-bottom: 8px;
/*border-bottom: 1px solid #DDD;*/
} }
/* Responsive */ /* Responsive */
@media (max-width: 979px) { @media (max-width: 979px) {
+21 -21
View File
@@ -6,22 +6,22 @@
.tags .lead .badge { .tags .lead .badge {
margin-top: 5px; margin-top: 5px;
} }
.tags .tags-groups { .tags-groups {
list-style: none; list-style: none;
margin: 0 0 20px; margin: 0 0 20px;
padding: 0; padding: 0;
} }
.tags .tags-groups:after { .tags-groups:after {
content: ""; content: "";
clear: both; clear: both;
height: 0; height: 0;
display: block; display: block;
visibility: hidden; visibility: hidden;
} }
.tags .tags-groups.module-tags li.default a { .tags-groups.module-tags li.default a {
margin-left: 5px; margin-left: 5px;
} }
.tags .tags-groups li { .tags-groups li {
overflow: hidden; overflow: hidden;
float: left; float: left;
width: auto; width: auto;
@@ -39,7 +39,7 @@
-o-transition: all .2s linear; -o-transition: all .2s linear;
transition: all .2s linear; transition: all .2s linear;
} }
.tags .tags-groups li.mark { .tags-groups li.mark {
width: 0; width: 0;
height: 0; height: 0;
padding: 0; padding: 0;
@@ -49,28 +49,28 @@
opacity: 0; opacity: 0;
visibility: hidden; visibility: hidden;
} }
.tags .tags-groups li.active { .tags-groups li.active {
background-color: #3a87ad; background-color: #3a87ad;
} }
.tags .tags-groups li.active .amount { .tags-groups li.active .amount {
color: #8cb8be; color: #8cb8be;
} }
.tags .tags-groups li a { .tags-groups li a {
text-decoration: none; text-decoration: none;
color: #ededed; color: #ededed;
} }
.tags .tags-groups li .amount { .tags-groups li .amount {
color: #fdcf3b; color: #fdcf3b;
float: right; float: right;
margin-left: 15px; margin-left: 15px;
} }
.tags .tags-groups li .card { .tags-groups li .card {
position: relative; position: relative;
margin: 0; margin: 0;
width: 18px; width: 18px;
height: 18px; height: 18px;
} }
.tags .tags-groups li .card:after { .tags-groups li .card:after {
font-family: FontAwesome; font-family: FontAwesome;
content: '\f111'; content: '\f111';
color: #fdcf3b; color: #fdcf3b;
@@ -82,13 +82,13 @@
left: 0; left: 0;
top: 0; top: 0;
} }
.tags .tags-groups li .card.active:after { .tags-groups li .card.active:after {
content: '\f058'; content: '\f058';
font-size: 18px; font-size: 18px;
left: -2px; left: -2px;
top: 1px; top: 1px;
} }
.tags .tags-groups li .card input { .tags-groups li .card input {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
@@ -110,10 +110,10 @@
#tags-merger form { #tags-merger form {
margin-bottom: 0; margin-bottom: 0;
} }
#tags-merger .tags .tags-groups li { #tags-merger .tags-groups li {
cursor: pointer; cursor: pointer;
} }
#tags-merger .tags .tags-groups li.def { #tags-merger .tags-groups li.def {
background-color: #468847; background-color: #468847;
} }
#tags-merger .modal-body .pull-left { #tags-merger .modal-body .pull-left {
@@ -127,22 +127,22 @@
.tags .tags-groups li.default { .tags-groups li.default {
background-color: #468847; background-color: #468847;
} }
.tags .tags-groups li.default.active { .tags-groups li.default.active {
background-color: #3a87ad; background-color: #3a87ad;
} }
.tags .tags-groups li.default .amount { .tags-groups li.default .amount {
color: #8cbe9a; color: #8cbe9a;
} }
.tags .tags-groups li.default.active .amount { .tags-groups li.default.active .amount {
color: #8cb8be; color: #8cb8be;
} }
.tags .tags-groups li.default .card:after { .tags-groups li.default .card:after {
color: #8cbe9a; color: #8cbe9a;
} }
.tags .tags-groups li.active .card:after { .tags-groups li.active .card:after {
color: #8cb8be; color: #8cb8be;
} }
+16
View File
@@ -26,6 +26,12 @@
margin-top: 4px; margin-top: 4px;
margin-left: 10px; margin-left: 10px;
} }
.topnav .btn-group {
margin-left: 0;
}
.topnav .view-switch {
margin-left: 10px;
}
/* Bottom Nav */ /* Bottom Nav */
.bottomnav { .bottomnav {
@@ -41,6 +47,16 @@
.bottomnav .action { .bottomnav .action {
margin-bottom: 6px; margin-bottom: 6px;
} }
.bottomnav .divider {
display: inline-block;
position: relative;
margin: 0 5px;
background-color: #E0E0E0;
width: 1px;
height: 16px;
top: 5px;
box-shadow: 1px 0 0 #FFF;
}
.bottomnav .pagination { .bottomnav .pagination {
margin: 0; margin: 0;
} }
@@ -223,7 +223,7 @@
#orbit-bar { #orbit-bar {
margin: 0; margin: 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Chivo";
font-size: 12px; font-size: 12px;
line-height: 20px; line-height: 20px;
color: #333333; color: #333333;
@@ -1,10 +1,7 @@
class Admin::AdBannersController < OrbitBackendController class Admin::AdBannersController < OrbitBackendController
open_for_visitor :only => [:index, :show]
before_filter :force_order_for_visitor,:only=>[:index, :show] open_for_manager :except => [:index,:show,:update,:realtime_preview]
before_filter :force_order_for_user,:except => [:index, :show] open_for_sub_manager :except => [:index, :show]
before_filter :for_app_sub_manager,:except => [:index, :show]
before_filter :for_app_manager,:except => [:index,:show,:update,:realtime_preview]
def rename def rename
@ad_banner = AdBanner.find(params[:id]) @ad_banner = AdBanner.find(params[:id])
@@ -43,6 +40,7 @@ class Admin::AdBannersController < OrbitBackendController
def edit def edit
@ad_banner = AdBanner.find(params[:id]) @ad_banner = AdBanner.find(params[:id])
render layout: false
end end
def update def update
@@ -60,6 +58,7 @@ class Admin::AdBannersController < OrbitBackendController
def index def index
@ad_banners = AdBanner.all @ad_banners = AdBanner.all
@active = @ad_banners.first @active = @ad_banners.first
@tags = get_tags
end end
end end
@@ -22,8 +22,10 @@ class Admin::AdImagesController < Admin::AdBannersController
end end
def update def update
@ad_image = AdImage.find(params[:id]) @ad_banner = AdBanner.find params[:ad_banner][:id]
@ad_image = AdImage.find(params[:ad_image][:id])
@ad_image.update_attributes(params[:ad_image]) @ad_image.update_attributes(params[:ad_image])
@ad_banner.ad_images << @ad_image
redirect_to admin_ad_images_path redirect_to admin_ad_images_path
end end
@@ -38,10 +40,10 @@ class Admin::AdImagesController < Admin::AdBannersController
end end
def create def create
# @ad_banner = AdBanner.find params[:ad_banner][:id] @ad_banner = AdBanner.find params[:ad_banner][:id]
@ad_image = AdImage.new params[:ad_image] @ad_image = AdImage.new params[:ad_image]
#@ad_image.to_save = true @ad_image.to_save = true
#@ad_banner.ad_images << ad_image @ad_banner.ad_images << @ad_image
if @ad_image.save if @ad_image.save
redirect_to admin_ad_images_path redirect_to admin_ad_images_path
+37 -14
View File
@@ -3,7 +3,17 @@ class Admin::AssetsController < OrbitBackendController
before_filter :setup_vars before_filter :setup_vars
def index def index
@assets = (params[:sort] || @filter) ? get_sorted_and_filtered("asset") : Asset.all.page(params[:page]).per(10) @assets = (params[:sort] || @filter) ? get_sorted_and_filtered("asset") : Asset.all.desc(:created_at).page(params[:page]).per(10)
if params[:type] == "images"
@assets = @assets.where(:content_type => /^image/)
end
@tag = ModuleTag.new
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
raise ModuleAppError, 'Can not find ModuleApp' if @module_app.nil?
@module_app_id = @module_app.id rescue nil
render :layout => "assets"
end end
def show def show
@@ -22,12 +32,8 @@ class Admin::AssetsController < OrbitBackendController
def edit def edit
@asset = Asset.find(params[:id]) @asset = Asset.find(params[:id])
@asset_categories = AssetCategory.all
@tags = get_tags @tags = get_tags
respond_to do |format| render layout: false
format.html {}
format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} }
end
end end
def create def create
@@ -64,10 +70,7 @@ class Admin::AssetsController < OrbitBackendController
def update def update
@asset = Asset.find(params[:id]) @asset = Asset.find(params[:id])
if @asset.update_attributes(params[:asset]) if @asset.update_attributes(params[:asset])
respond_to do |format| render layout: false
format.html { redirect_to admin_assets_url }
format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'replaceWith', :id => "asset_#{@asset.id}", :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} }
end
else else
flash[:error] = t('update.fail') flash[:error] = t('update.fail')
@asset_categories = AssetCategory.all @asset_categories = AssetCategory.all
@@ -95,11 +98,31 @@ class Admin::AssetsController < OrbitBackendController
redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
end end
def delete_files
@files = params[:files]
@files.each do |file|
asset = Asset.find(file)
asset.destroy
end
@assets = (params[:sort] || @filter) ? get_sorted_and_filtered("asset") : Asset.all.desc(:created_at).page(params[:page]).per(10)
if params[:type] == "images"
@assets = @assets.where(:content_type => /^image/)
end
# render :json =>{"success"=>true}.to_json
end
def file_upload def file_upload
@asset = Asset.new @files = params['files']
@asset_categories = AssetCategory.all a = Array.new
@tags = get_tags @files.each do |file|
render :layout => false @asset = current_user.assets.new
@asset.data = file
@asset.title_translations = {:en => file.original_filename, :zh_tw => file.original_filename}
# @asset.title_translations[:zh_tw] = file.original_filename
@asset.save!
a << {"url"=>@asset.data.url}
end
render :json=>{"files"=>a}.to_json
end end
def file_select def file_select
@@ -1,13 +1,13 @@
class Admin::AuthorizationsController < OrbitBackendController class Admin::AuthorizationsController < OrbitBackendController
before_filter :admin_or_manager prepend_before_filter :admin_or_manager
def index def index
@module_apps ||= ModuleApp.where(is_authorizable: true).order_by([:title, :asc]) @module_apps ||= ModuleApp.any_of({is_authorizable: true}, {is_approvable: true}).order_by([:title, :asc])
if @module_apps && @module_apps.include?(@module_app) if @module_apps && @module_apps.include?(@module_app)
if @type if @type
case @type case @type
when 'category', 'approval' when 'category_authorization', 'category_approval'
if @module_app.has_category if @module_app.has_category
@objects = @module_app.categories @objects = @module_app.categories
else else
@@ -18,12 +18,12 @@ class Admin::AuthorizationsController < OrbitBackendController
end end
unless @objects.blank? unless @objects.blank?
@object ||= @objects.first @object ||= @objects.first
@users = @object.get_object_auth_by_title("#{@type}_#{@module_app.key}").auth_users @users = @object.get_authorization_by_title("#{@type}_#{@module_app.key}").authorized_users rescue nil
else else
@error = t(:no_data) @error = t(:no_data)
end end
else else
@users = @module_app.managing_users @users = @module_app.managers
end end
elsif @module_apps elsif @module_apps
@module_app = @module_apps.first @module_app = @module_apps.first
@@ -33,35 +33,34 @@ class Admin::AuthorizationsController < OrbitBackendController
end end
end end
def add(users) def add_roles
unless users.blank? roles = Role.find(params[:role_ids]) rescue nil
if @type unless roles.nil?
if @object authorization = get_or_create_authorization
object_auth = @object.get_object_auth_by_title("#{@type}_#{@module_app.key}") add_roles_to_auth(authorization, roles)
add_users_to_object_auth(object_auth, users)
else
@error = t(:no_data)
end
else
add_managers(users) unless users.blank?
end
end end
@users = users @users = authorization.authorized_users
render 'admin/authorizations/insert_users' render 'admin/authorizations/reload_users'
end
def add_sub_roles
sub_roles = SubRole.find(params[:sub_role_ids]) rescue nil
unless sub_roles.nil?
authorization = get_or_create_authorization
add_sub_roles_to_auth(authorization, sub_roles)
end
@users = authorization.authorized_users
render 'admin/authorizations/reload_users'
end end
def add_users def add_users
users = User.find(params[:user_ids]) rescue [] users = User.find(params[:user_ids]) rescue nil
add(users) unless users.nil?
end authorization = get_or_create_authorization
add_users_to_auth(authorization, users)
def add_roles
roles = Role.find(params[:role_ids]) rescue []
users = roles.inject([]) do |users, role|
users += role.users.all.entries
users
end end
add(users) @users = authorization.authorized_users
render 'admin/authorizations/reload_users'
end end
def modal_select def modal_select
@@ -70,63 +69,103 @@ class Admin::AuthorizationsController < OrbitBackendController
if @type if @type
@object_id = @object.id if @object @object_id = @object.id if @object
@sorted_users = roles.inject({}) do |users, role| @sorted_users = roles.inject({}) do |users, role|
users[role] = role.users.where(admin: false).not_guest_user - existing_users - @module_app.managing_users users[role] = role.users.where(admin: false) - existing_users - @module_app.managers
users users
end end
else else
@sorted_users = roles.inject({}) do |users, role| @sorted_users = roles.inject({}) do |users, role|
users[role] = role.users.where(admin: false).not_guest_user - existing_users users[role] = role.users.where(admin: false) - existing_users
users users
end end
end end
end end
def remove_roles
roles = Role.find(params[:role_ids]) rescue []
unless roles.blank?
authorization = get_or_create_authorization
remove_roles_form_auth(authorization, roles)
end
@users = authorization.authorized_users
render 'admin/authorizations/reload_users'
end
def remove_sub_roles
sub_roles = SubRole.find(params[:sub_role_ids]) rescue []
unless sub_roles.blank?
authorization = get_or_create_authorization
remove_sub_roles_from_auth(authorization, sub_roles)
end
@users = authorization.authorized_users
render 'admin/authorizations/reload_users'
end
def remove_users def remove_users
@users = User.find(params[:ids]) rescue [] @users = User.find(params[:ids]) rescue []
unless @users.blank? unless @users.blank?
if @type authorization = get_or_create_authorization
if @object remove_users_from_auth(authorization, @users)
object_auth = @object.get_object_auth_by_title("#{@type}_#{@module_app.key}")
remove_users_form_object_auth(object_auth, @users)
else
@error = t(:no_data)
end
else
remove_managers(@users)
end
end end
render 'admin/authorizations/remove_users' @users = authorization.authorized_users
render 'admin/authorizations/reload_users'
end end
protected protected
def add_managers(users) def add_roles_to_auth(authorization, roles)
users.each do |user| authorization.add_roles(roles)
@module_app.assign_manager(user, current_user) end
def add_sub_roles_to_auth(authorization, sub_roles)
authorization.add_sub_roles(sub_roles)
end
def add_users_to_auth(authorization, users)
authorization.add_users(users)
end
def get_or_create_authorization
case @type
when 'category_approval'
if @object
@object.auth_approval || @object.create_auth_approval(module_app_id: @module_app.id, title: "#{@type}_#{@module_app.key}")
else
@error = t(:no_data)
end
when 'category_authorization'
if @object
@object.auth_sub_manager || @object.create_auth_sub_manager(module_app_id: @module_app.id, title: "#{@type}_#{@module_app.key}")
else
@error = t(:no_data)
end
when nil
@module_app.auth_manager || @module_app.create_auth_manager(module_app_id: @module_app.id, title: @module_app.key)
else
auth = @object.get_authorization_by_title("#{@type}_#{@module_app.key}")
unless auth
auth = @object.create_auth_approval(module_app_id: @module_app.id, title: "#{@type}_#{@module_app.key}") if @type.include?('approval')
auth = @object.create_auth_sub_manager(module_app_id: @module_app.id, title: "#{@type}_#{@module_app.key}") if @type.include?('authorization')
end
auth
end end
end end
def add_users_to_object_auth(object_auth, users) def remove_roles_form_auth(authorization, roles)
users.each do |user| authorization.remove_roles(roles)
object_auth.add_user_to_privilege_list(user)
end
end end
def remove_managers(users) def remove_sub_roles_from_auth(authorization, sub_roles)
users.each do |user| authorization.remove_sub_roles(sub_roles)
@module_app.remove_manager(user)
end
end end
def remove_users_form_object_auth(object_auth, users) def remove_users_from_auth(authorization, users)
users.each do |user| authorization.remove_users(users)
object_auth.remove_user_from_privilege_list(user)
end
end end
private private
def admin_or_manager def admin_or_manager
@override_can_use = true
setup_vars setup_vars
authenticate_user! authenticate_user!
user_is_manager? user_is_manager?
@@ -136,7 +175,7 @@ class Admin::AuthorizationsController < OrbitBackendController
@module_app = ModuleApp.first(conditions: {:key => params[:module]} ) if params[:module] @module_app = ModuleApp.first(conditions: {:key => params[:module]} ) if params[:module]
@type = params[:type].underscore if params[:type] @type = params[:type].underscore if params[:type]
if @type if @type
@klass = @type.classify.constantize rescue nil @klass = @type.gsub('_authorization', '').gsub('_approval', '').classify.constantize rescue nil
@object = @klass.find(params[:id]) rescue nil @object = @klass.find(params[:id]) rescue nil
end end
end end
@@ -1,8 +1,6 @@
class Admin::DashboardsController < OrbitBackendController class Admin::DashboardsController < OrbitBackendController
#before_filter :set_current_user open_for_visitor
#before_filter :authenticate_user!, :except => [:index]
# before_filter :is_admin?
layout "basic_back_end" layout "basic_back_end"
@@ -0,0 +1,573 @@
# encoding: utf-8
require 'net/http'
require 'open-uri'
class Admin::ImportDataController < OrbitBackendController
helper Admin::PagePartsHelper
include Admin::FrontendWidgetInterface
def get_teacher_data
uri = URI("https://localhost:8000/teachers.xml")
#params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
#uri.query = URI.encode_www_form(params)
res = Net::HTTP.get_response(uri)
@teacher_data = Hash.from_xml(res.body)
@teachers = @teacher_data["objects"]
@i = 5000
@teachers.each do |hash|
# @roles = Role.skip(1).first
@roles = Role.all
@teacher = User.new
I18n.locale = :zh_tw
if !hash['teacher_zh_tw'].blank?
@teacher.first_name = hash['teacher_zh_tw']
elsif hash['teacher_zh_tw'].blank? && !hash['teacher_en'].blank?
@teacher.first_name = hash['teacher_en']
elsif hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank?
@teacher.first_name = "Please Fill the Name"
end
I18n.locale = :en
if !hash['teacher_en'].blank?
@teacher.first_name = hash['teacher_en']
elsif hash['teacher_en'].blank? && !hash['teacher_zh_tw'].blank?
@teacher.first_name = hash['teacher_zh_tw']
elsif hash['teacher_en'].blank? && hash['teacher_zh_tw'].blank?
@teacher.first_name = "Please Fill the Name"
end
#@teacher.first_name = hash['teacher_en']
@teacher.ntu_seq = hash['ntu_seq']
@teacher.sid = hash['ntu_seq']
@teacher.role_ids = ["#{@roles.skip(1).first.id}"]
@teacher.password = "testpass"
@i += 10
if !hash['email'].blank?
@user = User.where(email: "#{hash['email']}")
if @user.length == 0
@teacher.email = hash['email']
elsif @user.length > 0
@teacher.email = "#{@i}duplicate@ntu.edu.tw"
end
else
@teacher.email = "#{@i}@ntu.edu.tw"
end
if hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank?
@teacher.user_id = "defaultuser"
elsif hash['teacher_en'].blank?
@teacher.user_id = hash['teacher_zh_tw']
elsif hash['teacher_zh_tw']
@teacher.user_id = hash['teacher_en']
end
@teacher.save!
end
end
def get_book_data
uri = URI("http://ann.cc.ntu.edu.tw/Achv/xmlTeacherData.asp")
params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
uri.query = URI.encode_www_form(params)
res = Net::HTTP.get_response(uri)
teachers = User.all
teachers.each do |hash|
if hash.sid.present?
ntu_seq = hash.sid
books_xml = Nokogiri::XML( \
open("http://ann.cc.ntu.edu.tw/Achv/xmlBook.asp?Seq=#{ntu_seq}"))
@books = books_xml.xpath("//Book").map do |book_node|
{
author: (book_node>"Authors").text,
year: (book_node>"PublishYear").text,
title: (book_node>"DocTitle").text,
remarks: (book_node>"Remarks").text,
publisher: (book_node>"Publisher").text,
book_title: (book_node>"BookTitle").text
}
end
if @books.present?
@books.each do |b|
@book = WritingBook.new
I18n.locale = :zh_tw
@book.authors = b[:author]
@book.paper_title = b[:title]
@book.book_title = b[:book_title]
@book.note = b[:remarks]
@book.publisher = b[:publisher]
I18n.locale = :en
@book.authors = b[:author]
@book.paper_title = b[:title]
@book.book_title = b[:book_title]
@book.note = b[:remarks]
@book.publisher = b[:publisher]
@book.year = b[:year]
@book.create_user_id = hash.id
@book.save
end
else
puts "No books by Teacher"
end
end
end
end
def get_conference_data
uri = URI("http://ann.cc.ntu.edu.tw/Achv/xmlTeacherData.asp")
params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
uri.query = URI.encode_www_form(params)
res = Net::HTTP.get_response(uri)
teachers = User.all
teachers.each do |hash|
if hash.sid.present?
ntu_seq = hash.sid
conference_xml = Nokogiri::XML( \
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=C"))
#open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
@conference_papers = conference_xml.xpath("//Paper").map do |cp_node|
{
author: (cp_node>"Authors").text,
year: (cp_node>"PublishYear").text,
title: (cp_node>"PaperTitle").text,
conference: (cp_node>"PublishOn").text,
date: Date::MONTHNAMES[(cp_node>"PublishMonth").text.to_i],
location: "#{(cp_node>"Country").text} #{(cp_node>"location").text}",
conference_title: (cp_node>"PublishOn").text,
remarks: (cp_node>"Remarks").text
}
end
if @conference_papers.present?
@conference_papers.each do |b|
@conference_paper = WritingConference.new
I18n.locale = :zh_tw
@conference_paper.authors = b[:author]
if b[:title].blank?
@conference_paper.paper_title = "No Title Present"
else
@conference_paper.paper_title = b[:title]
end
if b[:conference_title].blank?
@conference_paper.conference_title = "No Title Present"
else
@conference_paper.conference_title = b[:conference_title]
end
@conference_paper.note = b[:remarks]
I18n.locale = :en
@conference_paper.authors = b[:author]
if b[:title].blank?
@conference_paper.paper_title = "No Title Present"
else
@conference_paper.paper_title = b[:title]
end
if b[:conference_title].blank?
@conference_paper.conference_title = "No Title Present"
else
@conference_paper.conference_title = b[:conference_title]
end
@conference_paper.note = b[:remarks]
@conference_paper.location = b[:location]
@conference_paper.year = b[:year]
@conference_paper.create_user_id = hash.id
@conference_paper.save!
end
else
puts "No conference by Teacher"
end
end
end
end
def get_journal_paper_data
uri = URI("http://ann.cc.ntu.edu.tw/Achv/xmlTeacherData.asp")
params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
uri.query = URI.encode_www_form(params)
res = Net::HTTP.get_response(uri)
teachers = User.all
teachers.each do |hash|
if hash.sid.present?
ntu_seq = hash.sid
paper_xml = Nokogiri::XML( \
#open("http://versatile.management.ntu.edu.tw/publication1/journal/#{ntuseq}.xml"))
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=J"))
@journal_papers = paper_xml.xpath("//Paper").map do |paper_node|
{
author: (paper_node>"Authors").text,
year: (paper_node>"PublishYear").text,
title: (paper_node>"PaperTitle").text,
journal: (paper_node>"PublishOn").text,
volume:(paper_node>"Volume").text,
volumeno:(paper_node>"VolumeNo").text,
beginpage:(paper_node>"BeginPage").text,
endpage:(paper_node>"EndPage").text,
subgroup:(paper_node>"subgroup").text,
remarks: (paper_node>"Remarks").text,
cate: ((paper_node>"subgroup")>"Group").text
}
end
if @journal_papers.present?
@journal_papers.each do |b|
@journal_paper = WritingJournal.new
I18n.locale = :zh_tw
@journal_paper.authors = b[:author]
if b[:title].blank?
@journal_paper.paper_title = "No Title Present"
else
@journal_paper.paper_title = b[:title]
end
@journal_paper.journal_title = b[:journal]
@journal_paper.note = b[:remarks]
I18n.locale = :en
@journal_paper.authors = b[:author]
if b[:title].blank?
@journal_paper.paper_title = "No Title Present"
else
@journal_paper.paper_title = b[:title]
end
@journal_paper.journal_title = b[:journal]
@journal_paper.note = b[:remarks]
@journal_paper.year = b[:year]
@journal_paper.vol_no = b[:volumeno]
@journal_paper.form_to_start = b[:beginpage]
@journal_paper.form_to_end = b[:endpage]
if !b[:cate].blank?
@level_type = JournalLevelType.where(:key => b[:cate])
if @level_type.present?
@journal_paper.journal_level_type_ids = ["#{@level_type.first.id}"]
end
end
@journal_paper.create_user_id = hash.id
@journal_paper.save!
end
else
puts "No journal paper by Teacher"
end
end
end
end
def sync_conference_data
@conference_data = WritingConference.where(create_user_id: "#{params[:user_id]}")
@conference_data.delete_all
@user = User.find("#{params[:user_id]}")
# teachers.each do |hash|
if @user.sid.present?
ntu_seq = @user.sid
conference_xml = Nokogiri::XML( \
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=C"))
#open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
@conference_papers = conference_xml.xpath("//Paper").map do |cp_node|
{
author: (cp_node>"Authors").text,
year: (cp_node>"PublishYear").text,
title: (cp_node>"PaperTitle").text,
conference: (cp_node>"PublishOn").text,
date: Date::MONTHNAMES[(cp_node>"PublishMonth").text.to_i],
location: "#{(cp_node>"Country").text} #{(cp_node>"location").text}",
conference_title: (cp_node>"PublishOn").text,
remarks: (cp_node>"Remarks").text
}
end
if @conference_papers.present?
@conference_papers.each do |b|
@conference_paper = WritingConference.new
I18n.locale = :zh_tw
@conference_paper.authors = b[:author]
if b[:title].blank?
@conference_paper.paper_title = "No Title Present"
else
@conference_paper.paper_title = b[:title]
end
if b[:conference_title].blank?
@conference_paper.conference_title = "No Title Present"
else
@conference_paper.conference_title = b[:conference_title]
end
@conference_paper.note = b[:remarks]
I18n.locale = :en
@conference_paper.authors = b[:author]
if b[:title].blank?
@conference_paper.paper_title = "No Title Present"
else
@conference_paper.paper_title = b[:title]
end
if b[:conference_title].blank?
@conference_paper.conference_title = "No Title Present"
else
@conference_paper.conference_title = b[:conference_title]
end
@conference_paper.note = b[:remarks]
@conference_paper.location = b[:location]
@conference_paper.year = b[:year]
@conference_paper.create_user_id = @user.id
@conference_paper.save!
end
else
puts "No conference by Teacher"
end
end
respond_to do |format|
format.html
format.json { render json: {"success"=>true}.to_json}
end
end
def sync_journal_paper_data
@journal_data = WritingJournal.where(create_user_id: "#{params[:user_id]}")
@journal_data.delete_all
@user = User.find("#{params[:user_id]}")
# teachers.each do |hash|
if @user.sid.present?
ntu_seq = @user.sid
paper_xml = Nokogiri::XML( \
#open("http://versatile.management.ntu.edu.tw/publication1/journal/#{ntuseq}.xml"))
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=J"))
@journal_papers = paper_xml.xpath("//Paper").map do |paper_node|
{
author: (paper_node>"Authors").text,
year: (paper_node>"PublishYear").text,
title: (paper_node>"PaperTitle").text,
journal: (paper_node>"PublishOn").text,
volume:(paper_node>"Volume").text,
volumeno:(paper_node>"VolumeNo").text,
beginpage:(paper_node>"BeginPage").text,
endpage:(paper_node>"EndPage").text,
subgroup:(paper_node>"subgroup").text,
remarks: (paper_node>"Remarks").text,
cate: ((paper_node>"subgroup")>"Group").text
}
end
if @journal_papers.present?
@journal_papers.each do |b|
@journal_paper = WritingJournal.new
I18n.locale = :zh_tw
@journal_paper.authors = b[:author]
if b[:title].blank?
@journal_paper.paper_title = "No Title Present"
else
@journal_paper.paper_title = b[:title]
end
@journal_paper.journal_title = b[:journal]
@journal_paper.note = b[:remarks]
I18n.locale = :en
@journal_paper.authors = b[:author]
if b[:title].blank?
@journal_paper.paper_title = "No Title Present"
else
@journal_paper.paper_title = b[:title]
end
@journal_paper.journal_title = b[:journal]
@journal_paper.note = b[:remarks]
@journal_paper.year = b[:year]
@journal_paper.vol_no = b[:volumeno]
@journal_paper.form_to_start = b[:beginpage]
@journal_paper.form_to_end = b[:endpage]
if !b[:cate].blank?
@level_type = JournalLevelType.where(:key => b[:cate])
if @level_type.present?
@journal_paper.journal_level_type_ids = ["#{@level_type.first.id}"]
end
end
@journal_paper.create_user_id = @user.id
@journal_paper.save!
end
end
end
respond_to do |format|
format.html
format.json { render json: {"success"=>true}.to_json}
end
end
def sync_book_data
@books_data = WritingBook.where(create_user_id: "#{params[:user_id]}")
@books_data.delete_all
@user = User.find("#{params[:user_id]}")
# teachers.each do |hash|
if @user.sid.present?
ntu_seq = @user.sid
books_xml = Nokogiri::XML( \
open("http://ann.cc.ntu.edu.tw/Achv/xmlBook.asp?Seq=#{ntu_seq}"))
@books = books_xml.xpath("//Book").map do |book_node|
{
author: (book_node>"Authors").text,
year: (book_node>"PublishYear").text,
title: (book_node>"DocTitle").text,
remarks: (book_node>"Remarks").text,
publisher: (book_node>"Publisher").text,
book_title: (book_node>"BookTitle").text
}
end
if @books.present?
@books.each do |b|
@book = WritingBook.new
I18n.locale = :zh_tw
@book.authors = b[:author]
@book.paper_title = b[:title]
@book.book_title = b[:book_title]
@book.note = b[:remarks]
@book.publisher = b[:publisher]
I18n.locale = :en
@book.authors = b[:author]
@book.paper_title = b[:title]
@book.book_title = b[:book_title]
@book.note = b[:remarks]
@book.publisher = b[:publisher]
@book.year = b[:year]
@book.create_user_id = @user.id
@book.save
end
end
end
respond_to do |format|
format.html
format.json { render json: {"success"=>true}.to_json}
end
end
def get_announcement_data
uri = URI("https://localhost:8000/announcements.xml")
#params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
#uri.query = URI.encode_www_form(params)
res = Net::HTTP.get_response(uri)
@announcement_data = Hash.from_xml(res.body)
@announcements = @announcement_data["objects"]
@announcements.each do |hash|
@bulletin = Bulletin.new
I18n.locale = :zh_tw
if hash['announcement_title_zh_tw'].blank?
@bulletin.title = hash['announcement_title_en']
@bulletin.text = hash['announcement_content_zh_tw']
elsif hash['announcement_title_zh_tw'].blank? && hash['announcement_title_en'].blank?
@bulletin.title = "Please Fill the Name"
@bulletin.text = hash['announcement_content_zh_tw']
else
@bulletin.title = hash['announcement_title_zh_tw']
@bulletin.text = hash['announcement_content_zh_tw']
end
I18n.locale = :en
if hash['announcement_title_zh_tw'].blank? && hash['announcement_title_en'].blank?
@bulletin.title = "Please Fill the Name"
@bulletin.text = hash['announcement_content_en']
elsif hash['announcement_title_en'].blank?
@bulletin.title = hash['announcement_zh_tw']
@bulletin.text = hash['announcement_content_en']
elsif hash['announcement_title_zh_tw'].blank?
@bulletin.title = hash['announcement_title_en']
@bulletin.text = hash['announcement_content_en']
end
@bulletin.category_id = "51d2a16438178423c2000001"
@bulletin.is_pending = true
@bulletin.save!
end
end
def get_page_data
f = File.open("/home/rwub/orbit-db/ntu_mb/pages/management_pages.xml")
page_xml = Nokogiri::XML(f)
#open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
@pages = page_xml.xpath("//management-page").map do |cp_node|
{
menu_title: (cp_node>"menu-title").text,
content: (cp_node>"content").text
}
end
if @pages.present?
@i=0
@pages.each do |b|
get_variables_for_new
@page = Page.new
@page.parent = "4f45f3b9e9d02c5db900005d"
@page.design = "50ac424983e75219d2000021"
@page.theme_id = "50ac424a83e75219d2000025"
@page.menu_enabled_for= ["en", "zh_tw", ""]
@page.enabled_for= ["en", "zh_tw", ""]
@page.is_published = false
if b[:menu_title].blank?
@page.title = 'No Title Present'
@i += 1
@page.name = "#{@i}Page"
else
@i += 1
@page.title = b[:menu_title]
@page.name = "#{@i}Page"
end
if b[:content].blank?
@page.content = "No Content Present"
else
@page.content = b[:content]
end
@page.save!
end
else
puts "No Page Data"
end
end
def get_variables_for_new
@designs = Design.all.entries
@themes = Design.first.themes
@module_apps = ModuleApp.for_frontend_select
@app_frontend_urls = nil
@categories = nil
@tags = nil
@page_frontend_data_counts = nil
@frontend_styles = nil
@selected={
:design => @designs.first,
:theme=> @themes.first,
:module_app=>nil,#@module_apps.first
:app_frontend_url=> nil, #@module_apps.first
:category=>nil,
:tag=>nil,
:page_frontend_data_count=>nil,
:frontend_style => nil
}
end
end
+2 -2
View File
@@ -27,8 +27,8 @@ class Admin::ItemsController < OrbitBackendController
def update_position def update_position
item = Item.find(params[:id]) item = Item.find(params[:id])
item.shift_to(params[:parent_id], params[:position]) item.shift_to(params[:parent_id], params[:position].to_i)
render :nothing => true render :nothing => true, status: 200
end end
end end
@@ -0,0 +1,83 @@
class Admin::PersonalPluginIntrosController < OrbitMemberController
include OrbitControllerLib::DivisionForDisable
before_filter :authenticate_user!
before_filter :is_admin?
def index
get_types
@plugin_intro = @types.where(:user_id => params[:user_id]).first
if @plugin_intro.blank?
@set_type = @types.new()
@url = eval("panel_#{@app_type_name}_back_end_#{@app_type}s_path(:user_id=>params[:user_id])")
@verb = :post
else
@set_type = @types.find(@plugin_intro.id)
@url = polymorphic_path(["panel_#{@app_type_name}_back_end", @plugin_intro])
@verb = :put
end
end
def show
end
def new
end
def edit
end
def create
get_types
@plugin_intro = @types.new(params[:plugin_intro])
respond_to do |format|
if @plugin_intro.save
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:plugin_intro][:user_id],:show_plugin_profile=>@reback_name)) }
end
end
end
def update
get_types
@plugin_intro = @types.find(params[:id])
respond_to do |format|
if @plugin_intro.update_attributes(params[:plugin_intro])
format.html { redirect_to(admin_users_new_interface_url(:id=>params[:plugin_intro][:user_id],:show_plugin_profile=>@reback_name)) }
end
end
end
def destroy
end
protected
def get_types
@types = @app_type.classify.constantize
end
end
+9 -9
View File
@@ -4,19 +4,19 @@ class Admin::PluginsController < ApplicationController
def index def index
@plugins = OrbitApp::Plugin::Registration.all @plugins = OrbitApp::Plugin::Registration.all
if(!params[:show_plugin_profile].nil?) if(!params[:show_plugin_profile].nil?)
@right_partial = OrbitApp::Plugin::Registration.find_by_key(params[:show_plugin_profile]).admin_partial_path @right_partial = OrbitApp::Plugin::Registration.find_by_app_name(params[:show_plugin_profile]).admin_partial_path
if !@right_partial.blank? if !@right_partial.blank?
respond_to do |format| respond_to do |format|
format.html { redirect_to( @right_partial ) } format.html { redirect_to( @right_partial ) }
end end
else else
@right_partial = "" @right_partial = ""
end end
else else
@right_partial = "" @right_partial = ""
@@ -55,6 +55,15 @@ class Admin::SitesController < OrbitBackendController
end end
def search_engine
end
def preference
end
def ui_theme def ui_theme
end end
-3
View File
@@ -1,8 +1,5 @@
class Admin::TagsController < OrbitBackendController class Admin::TagsController < OrbitBackendController
include OrbitTag::Merging include OrbitTag::Merging
before_filter :force_order_for_visitor, only: [:index]
before_filter :force_order_for_user, except: [:index]
def index def index
@tags = @module_app.module_tags @tags = @module_app.module_tags
@@ -1,19 +1,10 @@
class Admin::UsersNewInterfaceController < OrbitMemberController class Admin::UsersNewInterfaceController < OrbitMemberController
helper MemberHelper helper MemberHelper
helper OrbitBackendHelper
# before_filter :authenticate_user!
# before_filter :set_attribute, :only => [:index, :show, :new, :edit]
before_filter :force_order_for_visitor,:only=>[:index,:show]
before_filter :force_order_for_user,:except => [:index,:show]
before_filter :set_attribute,:except => [:index,:show] before_filter :set_attribute,:except => [:index,:show]
open_for_visitor :only => [:index, :show]
def setup_vars
# @app_title ||= controller_path.split('/')[1].singularize
# @module_app ||= ModuleApp.first(conditions: {:key => @app_title} )
# raise ModuleAppError, 'Can not find ModuleApp' if @module_app.nil?
end
def index def index
get_tags get_tags
@@ -26,50 +17,64 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
@filter = params[:filter] @filter = params[:filter]
new_filter = params[:new_filter] @mq = params[:mq]
@new_filter = params[:new_filter]
if @filter && params[:clear] if @filter && params[:clear]
@filter.delete(params[:type]) @filter.delete(params[:type])
elsif @filter && new_filter elsif @filter && @new_filter
if @filter.has_key?(new_filter[:type]) && @filter[new_filter[:type]].include?(new_filter[:id].to_s) if @filter.has_key?(@new_filter[:type]) && @filter[@new_filter[:type]].include?(@new_filter[:id].to_s)
@filter[new_filter[:type]].delete(new_filter[:id].to_s) @filter[@new_filter[:type]].delete(@new_filter[:id].to_s)
elsif @filter.has_key?(new_filter[:type]) elsif @filter.has_key?(@new_filter[:type])
@filter[new_filter[:type]] << new_filter[:id].to_s @filter[@new_filter[:type]] << @new_filter[:id].to_s
else else
@filter.merge!({new_filter[:type] => [new_filter[:id].to_s]}) @filter.merge!({@new_filter[:type] => [@new_filter[:id].to_s]})
end end
elsif new_filter elsif @new_filter
@filter = {new_filter[:type] => [new_filter[:id].to_s]} @filter = {@new_filter[:type] => [@new_filter[:id].to_s]}
end end
if @filter.blank? if @filter.blank? and @mq.blank?
render case params[:at] render case params[:at]
when 'summary' when 'summary'
@users=User.not_guest_user.page(page_num).per(12).asc("_id").includes('avatar') @users=User.not_guest_user.page(page_num).per(12).desc("_id").includes('avatar')
"index_summary" "index_summary"
when 'thumbnail' when 'thumbnail'
@users=User.not_guest_user.page(page_num).per(36).asc("_id").includes('avatar') @users=User.not_guest_user.page(page_num).per(36).desc("_id").includes('avatar')
"index_thumbnail" "index_thumbnail"
else else
@users=User.not_guest_user.page(page_num).per(10).asc("_id").includes('avatar') @users=User.not_guest_user.page(page_num).per(10).desc("_id").includes('avatar')
"index" "index"
end end
else elsif @filter.blank? and !@mq.blank?
render case params[:at] render case params[:at]
when 'summary' when 'summary'
@users=User.not_guest_user.any_in(:role_ids=>@filter['role']).page(page_num).per(12).asc("_id").includes('avatar') @users=User.not_guest_user.any_of({:user_id => /#{@mq}/i}, {:first_name => /#{@mq}/i}, {:last_name => /#{@mq}/i}, {:email => /#{@mq}/i}, {:office_tel => /#{@mq}/i}).desc("_id").includes('avatar')
"index_summary" "index_summary"
when 'thumbnail' when 'thumbnail'
@users=User.not_guest_user.any_in(:role_ids=>@filter['role']).page(page_num).per(36).asc("_id").includes('avatar') @users=User.not_guest_user.any_of({:user_id => /#{@mq}/i}, {:first_name => /#{@mq}/i}, {:last_name => /#{@mq}/i}, {:email => /#{@mq}/i}, {:office_tel => /#{@mq}/i}).desc("_id").includes('avatar')
"index_thumbnail" "index_thumbnail"
else else
@users=User.not_guest_user.any_in(:role_ids=>@filter['role']).page(page_num).per(10).asc("_id").includes('avatar') @users=User.not_guest_user.any_of({:user_id => /#{@mq}/i}, {:first_name => /#{@mq}/i}, {:last_name => /#{@mq}/i}, {:email => /#{@mq}/i}, {:office_tel => /#{@mq}/i}).desc("_id").includes('avatar')
"index"
end
elsif !@filter.blank? and @mq.blank?
render case params[:at]
when 'summary'
@users=User.not_guest_user.any_in(:role_ids=>@filter['role']).page(page_num).per(12).desc("_id").includes('avatar')
"index_summary"
when 'thumbnail'
@users=User.not_guest_user.any_in(:role_ids=>@filter['role']).page(page_num).per(36).desc("_id").includes('avatar')
"index_thumbnail"
else
@users=User.not_guest_user.any_in(:role_ids=>@filter['role']).page(page_num).per(10).desc("_id").includes('avatar')
"index" "index"
end end
@@ -78,9 +83,18 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
end end
def show def show
@user = User.find(params[:id]) @user = User.find(params[:id])
@plugins = OrbitApp::Plugin::Registration.all @plugins = OrbitApp::Plugin::Registration.all
@ppname = Array.new
@plugins.each do |aa|
@ppname << [aa.sort_number.to_i, [aa.name, aa.app_name, aa.intro_app_name, aa.front_partial_path]]
end
@plugin_shows = @ppname.sort.collect {|v| {"name"=>v[1][0],"app_name"=>v[1][1],"intro_app_name"=>v[1][2],"front_partial_path"=>v[1][3]} }
@profile_data = [] @profile_data = []
@teacher_data = [] @teacher_data = []
@student_data = [] @student_data = []
@@ -93,9 +107,11 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
if(!params[:show_plugin_profile].nil?) if(!params[:show_plugin_profile].nil?)
@right_partial = OrbitApp::Plugin::Registration.find_by_key(params[:show_plugin_profile]).profile_partial_path rescue 'plugin_summary' @right_partial = OrbitApp::Plugin::Registration.find_by_app_name(params[:show_plugin_profile]).profile_partial_path rescue 'plugin_summary'
@plugin_app_name = OrbitApp::Plugin::Registration.find_by_app_name(params[:show_plugin_profile]).name rescue nil
else else
@right_partial = "plugin_summary" @right_partial = "plugin_summary"
@plugin_app_name = ''
end end
# @user.attribute_values.each{|att_val| # @user.attribute_values.each{|att_val|
@@ -225,7 +241,65 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
@user.destroy @user.destroy
end end
redirect_to :action => :index # redirect_to :action => :index
respond_to do |format|
format.html { redirect_to(admin_users_new_interface_index_url(:at=>params[:at])) }
# format.xml { head :ok }
format.js
end
end
def edit_order_card
@users = User.not_guest_user
@type = 'card'
render 'edit_order'
end
def edit_order_list
@users = User.not_guest_user
@type = 'list'
render 'edit_order'
end
def update_order_card
@error = false
if params[:users].present?
to_go = params[:users][:position].to_i
user_at_position = User.where(position: to_go).first
user = User.find(params[:users][:id])
if user_at_position
if user.position > user_at_position.position
user.move_above(user_at_position)
else
user.move_below(user_at_position)
end
end
end
render nothing: true, status: 200
end
def update_order_list
@error = []
if params[:users].present?
params[:users].values.sort.each do |pair|
to_go = pair[0].to_i
if to_go > 0
user_at_position = User.where(position: to_go - 1).first
user = User.find(pair[1])
if user_at_position && !(user_at_position == user)
if user.position > user_at_position.position
user.move_above(user_at_position)
else
user.move_below(user_at_position)
end
elsif to_go > User.count
user.move_to_bottom
end
end
end
end
@users = User.not_guest_user
end end
protected protected
+8 -3
View File
@@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base
helper_attr :site_valid_locales helper_attr :site_valid_locales
def check_backend_openness def check_backend_openness
if !Me.backend_openness_on if Site.first.backend_openness_on
redirect_to '/users/sign_in' if not (authenticate_user! and is_member? ) redirect_to '/users/sign_in' if not (authenticate_user! and is_member? )
end end
end end
@@ -140,16 +140,21 @@ class ApplicationController < ActionController::Base
# update session if passed # update session if passed
session[:locale] = params[:locale] if params[:locale] session[:locale] = params[:locale] if params[:locale]
browser_locale = condition = nil browser_locale = condition = nil
default_locale = @site.default_locale if @site.default_locale.present?
# check if locale is valid for non site pages # check if locale is valid for non site pages
if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s) if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s)
condition = VALID_LOCALES.include?(session[:locale]) condition = VALID_LOCALES.include?(session[:locale])
elsif session[:locale] elsif session[:locale]
condition = @site.in_use_locales.include?(session[:locale]) condition = @site.in_use_locales.include?(session[:locale])
elsif @site.default_locale.present?
default_locale = @site.default_locale
condition = @site.valid_locales.include?(default_locale)
else else
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
condition = @site.in_use_locales.include?(browser_locale) condition = @site.in_use_locales.include?(browser_locale)
end end
session[:locale] = condition ? (browser_locale || session[:locale]) : I18n.default_locale.to_s session[:locale] = condition ? ( browser_locale || session[:locale] || default_locale) : I18n.default_locale.to_s
I18n.locale = session[:locale].to_sym I18n.locale = session[:locale].to_sym
@site_in_use_locales = site_locales_default_head(@site.in_use_locales) @site_in_use_locales = site_locales_default_head(@site.in_use_locales)
@site_valid_locales = site_locales_default_head(@site.valid_locales) @site_valid_locales = site_locales_default_head(@site.valid_locales)
@@ -318,7 +323,7 @@ class ApplicationController < ActionController::Base
a << object if (value.include?(object.category.id.to_s) rescue nil) a << object if (value.include?(object.category.id.to_s) rescue nil)
end end
objects = a.uniq objects = a.uniq
when 'tag' when 'tags'
a = Array.new a = Array.new
objects.each do |object| objects.each do |object|
object.tags.each do |tag| object.tags.each do |tag|
+1 -1
View File
@@ -1,4 +1,4 @@
class DesktopAppsController < OrbitBackendController class DesktopAppsController < ApplicationController
require "net/http" require "net/http"
require "uri" require "uri"
require 'zip/zip' require 'zip/zip'
+14 -2
View File
@@ -1,12 +1,16 @@
class DesktopController< ApplicationController class DesktopController< ApplicationController
layout 'desktop' layout 'desktop'
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :check_desktop_open, :only => [:index,:show]
#to load pages... #to load pages...
# caches_page :index
def index def index
@desktop = current_user.desktop @desktop = current_user.desktop
@currentusername = current_user.name @currentusername = current_user.name
@currentname = current_user.first_name + current_user.last_name
@title = "Desktop - " + @currentusername @title = "Desktop - " + @currentusername
@section = @desktop.sections.first @section = @desktop.sections.first
end end
@@ -15,7 +19,7 @@ class DesktopController< ApplicationController
render :layout => "compatibility" render :layout => "compatibility"
end end
def desktop def desktop_container
render :layout => false render :layout => false
end end
@@ -335,7 +339,15 @@ class DesktopController< ApplicationController
b = {"success"=>"true"} b = {"success"=>"true"}
render :json=>b.to_json render :json=>b.to_json
end end
protected
def check_desktop_open
@site = Site.first
if @site.desktop_closed #Need to be change
redirect_to '/admin/dashboards'
end
end
end end
+1 -1
View File
@@ -1,4 +1,4 @@
class DesktopThemesController < OrbitBackendController class DesktopThemesController < ApplicationController
require "net/http" require "net/http"
require "uri" require "uri"
require 'zip/zip' require 'zip/zip'
@@ -1,4 +1,4 @@
class DesktopWidgetsController < OrbitBackendController class DesktopWidgetsController < ApplicationController
require "net/http" require "net/http"
require "uri" require "uri"
require 'zip/zip' require 'zip/zip'
+25 -3
View File
@@ -12,7 +12,16 @@ class FrontController < ApplicationController
end end
def show_footer def show_footer
render :text => @site.footer @page = Page.find(:all, :conditions => {:name => /terms/i})
@name = @page.first.name
@url = "/#{@name}"
if !@site.enable_terms_of_use
render :text => (@site.footer + "<a href='#{@url}'>Terms of Use</a>")
else
render :text => @site.footer
end
end end
def show_menu def show_menu
@@ -21,7 +30,15 @@ class FrontController < ApplicationController
end end
def show_site_sub_menu def show_site_sub_menu
render :text => @site.sub_menu @page = Page.find(:all, :conditions => {:name => /sitemap/i})
@name = @page.first.name
@url = "/#{@name}"
if !@site.sitemap_menu_in_header
render :text => (@site.sub_menu + "<a href='#{@url}'>Sitemap</a>")
else
render :text => @site.sub_menu
end
end end
def show_sitemap def show_sitemap
@@ -43,6 +60,11 @@ class FrontController < ApplicationController
@tags = module_app.sorted_tags_for_cloud @tags = module_app.sorted_tags_for_cloud
end end
def show_terms_of_use
@site = Site.first rescue nil
@terms = @site.terms_of_use
end
private private
def menu_level(page, current_page, current, menu) def menu_level(page, current_page, current, menu)
@@ -73,7 +95,7 @@ class FrontController < ApplicationController
res << " active" if (current_page.id.eql?(page.id) || current_page.descendant_of?(page)) res << " active" if (current_page.id.eql?(page.id) || current_page.descendant_of?(page))
res << "'>" res << "'>"
root = "/" root = "/"
res << "<a href='#{(page.class.to_s.eql?('Page') ? root + page.path : page.url)}'><span>#{page.title}</span></a>" res << "<a href='#{(page.class.to_s.eql?('Page') ? root + page.path : page.url)}' target=#{(page.class.to_s.eql?('Page') ? '_self' : '_blank')} ><span>#{page.title}</span></a>"
if page.visible_children.size > 0 && current < menu.levels if page.visible_children.size > 0 && current < menu.levels
res << "<span class='dot'></span>" res << "<span class='dot'></span>"
res << menu_level(page, current_page, current + 1, menu) res << menu_level(page, current_page, current + 1, menu)
+9 -1
View File
@@ -43,7 +43,7 @@ class MobileController < ApplicationController
def page def page
@page_title = t('mobile.page') @page_title = t('mobile.page')
@page_contexts = PageContext.where(:archived => false).page(params[:page_main]).per(15) @page_contexts = get_sorted_page_from_structure
end end
def page_content def page_content
@@ -57,4 +57,12 @@ class MobileController < ApplicationController
@no_footer = true if request.path =~ /app/ @no_footer = true if request.path =~ /app/
end end
def get_sorted_page_from_structure
page_contexts = Item.structure_ordered_items.inject([]){ |pages, page|
pages << page.page_contexts.where(archived: false).limit(1)[0] if page.is_a?(Page) && !page.page_contexts.blank?
pages
}
Kaminari.paginate_array(page_contexts).page(params[:page]).per(15)
end
end end
+1 -31
View File
@@ -1,7 +1,6 @@
class OrbitBackendController < ApplicationController class OrbitBackendController < ApplicationController
include OrbitCategory::Categorizing include OrbitCategory::Categorizing
include OrbitCoreLib::AppBackendUtility include OrbitCoreLib::Authorization
include OrbitCoreLib::PermissionUtility
include OrbitTag::Tagging include OrbitTag::Tagging
include AdminHelper include AdminHelper
include ApplicationHelper include ApplicationHelper
@@ -10,12 +9,6 @@ class OrbitBackendController < ApplicationController
layout "back_end" layout "back_end"
def setup_vars
@app_title ||= controller_path.split('/')[1].singularize
@module_app ||= ModuleApp.first(conditions: {:key => @app_title} )
raise ModuleAppError, 'Can not find ModuleApp' if @module_app.nil?
end
def get_statuses def get_statuses
status = [] status = []
status << 'is_top' status << 'is_top'
@@ -28,27 +21,4 @@ class OrbitBackendController < ApplicationController
end end
status status
end end
private
def force_order_for_visitor
check_backend_openness
setup_vars
set_current_user
end
def force_order_for_user
setup_vars
set_current_user
authenticate_user!
check_user_can_use
end
def check_user_can_use
unless check_permission
#redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
redirect_to root_url
end
end
end end
+1 -31
View File
@@ -1,7 +1,6 @@
class OrbitMemberController < ApplicationController class OrbitMemberController < ApplicationController
include OrbitCategory::Categorizing include OrbitCategory::Categorizing
include OrbitCoreLib::AppBackendUtility include OrbitCoreLib::Authorization
include OrbitCoreLib::PermissionUtility
include OrbitTag::Tagging include OrbitTag::Tagging
include AdminHelper include AdminHelper
include ApplicationHelper include ApplicationHelper
@@ -10,12 +9,6 @@ class OrbitMemberController < ApplicationController
layout "member" layout "member"
def setup_vars
@app_title ||= controller_path.split('/')[1].singularize
@module_app ||= ModuleApp.first(conditions: {:key => @app_title} )
raise ModuleAppError, 'Can not find ModuleApp' if @module_app.nil?
end
def get_statuses def get_statuses
status = [] status = []
status << 'is_top' status << 'is_top'
@@ -28,27 +21,4 @@ class OrbitMemberController < ApplicationController
end end
status status
end end
private
def force_order_for_visitor
check_backend_openness
setup_vars
set_current_user
end
def force_order_for_user
setup_vars
set_current_user
authenticate_user!
check_user_can_use
end
def check_user_can_use
unless check_permission
#redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
redirect_to root_url
end
end
end end
+9 -8
View File
@@ -4,18 +4,12 @@ class PagesController < ApplicationController
before_filter :check_frontend_open, :only => [:index,:show] before_filter :check_frontend_open, :only => [:index,:show]
# caches_page :index # caches_page :index
def check_frontend_open
if Me.frontend_closed and current_user.nil? #Need to be change
redirect_to '/admin/dashboards'
end
end
def index def index
@item = Page.find_by_name('home') @item = Page.find_by_name('home')
if @item if @item
delayed_impressionist(@item) delayed_impressionist(@item)
render_page render_page
else else
redirect_to '/admin/dashboards',:notice=>t(:need_home) redirect_to '/admin/dashboards',:notice=>t(:need_home)
# render :text => t(:need_home) # render :text => t(:need_home)
@@ -25,6 +19,7 @@ class PagesController < ApplicationController
def show def show
#begin #begin
@item = Item.first(:conditions => {:path => params[:page_name]}) @item = Item.first(:conditions => {:path => params[:page_name]})
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
delayed_impressionist(@item) delayed_impressionist(@item)
case @item.class.to_s case @item.class.to_s
@@ -32,7 +27,7 @@ class PagesController < ApplicationController
if params[:clicked_field_name] if params[:clicked_field_name]
render_page({"clicked_field_name"=>params["clicked_field_name"]}) unless save_from_no_lang_for_page render_page({"clicked_field_name"=>params["clicked_field_name"]}) unless save_from_no_lang_for_page
else else
render_page(params) unless save_from_no_lang_for_page render_page(params.except(:controller, :action, :page_name)) unless save_from_no_lang_for_page
end end
when 'Link' when 'Link'
redirect_to(@item[:url]) unless save_from_no_lang_for_page redirect_to(@item[:url]) unless save_from_no_lang_for_page
@@ -117,6 +112,12 @@ class PagesController < ApplicationController
end end
raise PageError,'Missing Frontend Page' if @item.nil? raise PageError,'Missing Frontend Page' if @item.nil?
end end
def check_frontend_open
if Site.first.frontend_open && current_user.nil? #Need to be change
redirect_to '/admin/dashboards'
end
end
def save_from_no_lang_for_page def save_from_no_lang_for_page
if @item.nil? or !@item.enabled_for_lang(I18n.locale.to_s) if @item.nil? or !@item.enabled_for_lang(I18n.locale.to_s)
+1 -1
View File
@@ -7,5 +7,5 @@ module Admin::AssetsHelper
end end
a.join(' - ') a.join(' - ')
end end
end end
+2 -6
View File
@@ -180,7 +180,7 @@ module ApplicationHelper
page_title = page.page_title ? page.page_title : page.title page_title = page.page_title ? page.page_title : page.title
if page.root? && @site.title if page.root? && @site.title
res << @site.title res << @site.title
elsif @site.title && @site.title_always_on elsif @site.title && !@site.title_always_on
res << @site.title + ' - ' + page_title res << @site.title + ' - ' + page_title
else else
res << page_title res << page_title
@@ -271,11 +271,7 @@ module ApplicationHelper
end end
def show_avatar(user) def show_avatar(user)
if (user.avatar? rescue false) image_tag(user.avatar.thumb.url)
image_tag(user.avatar.thumb.url)
else
image_tag "person.png"
end
end end
# NTU link # NTU link
+6 -5
View File
@@ -34,7 +34,8 @@ module AttributeFieldsHelper
value = (can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value) rescue nil value = (can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value) rescue nil
key_field = can_muti_lang_input? ? "[#{key}]" : "" key_field = can_muti_lang_input? ? "[#{key}]" : ""
place_holder= @panel_setting["placeholder"][key] rescue '' place_holder= @panel_setting["placeholder"][key] rescue ''
result = text_area_tag(get_field_name_base + key_field, value,@markup_options.merge({:placeholder=>place_holder,:for=>key})) # result = text_area_tag(get_field_name_base + key_field, value,@markup_options.merge({:placeholder=>place_holder,:for=>key}))
result = text_field_tag(get_field_name_base + key_field, value,@markup_options.merge({:placeholder=>place_holder,:for=>key}))
add_ext= @attribute_value.address_ext[key] rescue {} add_ext= @attribute_value.address_ext[key] rescue {}
@@ -181,7 +182,7 @@ protected
def lang_panel_tabbable_wrapper(add_more_params,&block) def lang_panel_tabbable_wrapper(add_more_params,&block)
add_more_counter = '' add_more_counter = ''
if self.markup=='text_area' or self.markup=='address' if self.markup=='text_area' #or self.markup=='address'
tmp1 = VALID_LOCALES.collect do |key| tmp1 = VALID_LOCALES.collect do |key|
value = @prefiled_value[key] rescue nil value = @prefiled_value[key] rescue nil
@@ -261,7 +262,7 @@ protected
link_to(I18nVariable.from_locale(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale.to_s ? "active" : nil)}",:for=>key) link_to(I18nVariable.from_locale(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale.to_s ? "active" : nil)}",:for=>key)
end # of VALID_LOCALES.collect for tabs end # of VALID_LOCALES.collect for tabs
buff2 << link_to((content_tag :i,'',:class=>'icon-edit'),"##{get_pairing_tab_class({})}_m_window", :role=>"button",:class=>'btn',:data=>{:toggle=>"modal"}) if self.markup == 'address' buff2 << link_to((content_tag :i,'',:class=>'icon-edit'),"#address-field", :role=>"button",:class=>'btn',:data=>{:toggle=>"modal"}) if self.markup == 'address'
buff2 << link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") if self.add_more buff2 << link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") if self.add_more
buff2.join.html_safe buff2.join.html_safe
end # of content ul end # of content ul
@@ -357,7 +358,7 @@ protected
# address = content_tag :div,:class=>"multipleInput editMore" do # address = content_tag :div,:class=>"multipleInput editMore" do
address = content_tag :div,:class=>"control-group" do address = content_tag :div,:class=>"control-group" do
label + content_tag(:div, controls_wrapper(&block), :class=>'controls') label + content_tag(:div, controls_wrapper(&block), :class=>'controls add-input')
end # of div multipleInput editMore end # of div multipleInput editMore
result = address result = address
@@ -452,7 +453,7 @@ protected
def gen_modal_dialog def gen_modal_dialog
render_anywhere("shared/attribute_field/address_modal_dialog",{ render_anywhere("shared/attribute_field/address_modal_dialog",{
:field_name=>title, :field_name=>title,
:html_id=>"#{get_pairing_tab_class({})}_m_window", :html_id=>"address-field",
:btn_class => "#{get_pairing_tab_class({})}", :btn_class => "#{get_pairing_tab_class({})}",
:field_name_basic => get_basic_field_name_base :field_name_basic => get_basic_field_name_base
} }
+3 -3
View File
@@ -199,7 +199,7 @@ module OrbitBackendHelper
objects.join(' ') objects.join(' ')
else else
objects = Array(objects).map do |object| objects = Array(objects).map do |object|
display_value(object.send(field)) display_value(object.send(field)) rescue ''
end end
objects.join(', ') objects.join(', ')
end end
@@ -321,9 +321,9 @@ module OrbitBackendHelper
def is_authorized(object) def is_authorized(object)
autorized = @module_app.authorizable_models.inject(false) do |autorized, klass| autorized = @module_app.authorizable_models.inject(false) do |autorized, klass|
if object.is_a?(klass.constantize) if object.is_a?(klass.constantize)
autorized ||= object.cur_user_is_sub_manager_of("#{klass.underscore}_#{@module_app.key}") autorized ||= object.user_can_sub_manage?(current_user)
else else
autorized ||= object.category.cur_user_is_sub_manager_of("category_#{@module_app.key}") autorized ||= object.category.user_can_sub_manage?(current_user)
end end
autorized autorized
end end
+10 -6
View File
@@ -34,8 +34,8 @@ module OrbitFormHelper
def date_picker(object_name, method, options) def date_picker(object_name, method, options)
custom = {} custom = {}
custom[:format] = 'yyyy-MM-dd' custom[:format] = options[:format] || 'yyyy/MM'
custom[:value] = display_date(options[:value]) if options[:value] custom[:value] = format_value(options[:value], custom[:format]) if options[:value]
custom[:picker_class] = 'date_picker' custom[:picker_class] = 'date_picker'
custom[:label] = options[:label] || I18n.t('datetime_picker.date.label') custom[:label] = options[:label] || I18n.t('datetime_picker.date.label')
custom[:placeholder] = options[:placeholder] || I18n.t('datetime_picker.date.placeholder') custom[:placeholder] = options[:placeholder] || I18n.t('datetime_picker.date.placeholder')
@@ -44,8 +44,8 @@ module OrbitFormHelper
def default_picker(object_name, method, options) def default_picker(object_name, method, options)
custom = {} custom = {}
custom[:format] = 'yyyy-MM-dd hh:mm' custom[:format] = options[:format] || 'yyyy/MM/dd hh:mm'
custom[:value] = display_date_time(options[:value]) if options[:value] custom[:value] = format_value(options[:value], custom[:format]) if options[:value]
custom[:picker_class] = 'default_picker' custom[:picker_class] = 'default_picker'
custom[:label] = options[:label] || I18n.t('datetime_picker.default.label') custom[:label] = options[:label] || I18n.t('datetime_picker.default.label')
custom[:placeholder] = options[:placeholder] || I18n.t('datetime_picker.default.placeholder') custom[:placeholder] = options[:placeholder] || I18n.t('datetime_picker.default.placeholder')
@@ -54,8 +54,8 @@ module OrbitFormHelper
def time_picker(object_name, method, options) def time_picker(object_name, method, options)
custom = {} custom = {}
custom[:format] = 'hh:mm' custom[:format] = options[:format] || 'hh:mm'
custom[:value] = display_time(options[:value]) if options[:value] custom[:value] = format_value(options[:value], custom[:format]) if options[:value]
custom[:picker_class] = 'time_picker' custom[:picker_class] = 'time_picker'
custom[:label] = options[:label] || I18n.t('datetime_picker.time.label') custom[:label] = options[:label] || I18n.t('datetime_picker.time.label')
custom[:placeholder] = options[:placeholder] || I18n.t('datetime_picker.time.placeholder') custom[:placeholder] = options[:placeholder] || I18n.t('datetime_picker.time.placeholder')
@@ -93,6 +93,10 @@ module OrbitFormHelper
end end
end end
def format_value(value, format)
value.strftime(format.gsub('yyyy', '%Y').gsub('MM', '%m').gsub('dd', '%d').gsub('hh', '%H').gsub('mm', '%M'))
end
end end
module Orbit::FormBuilder module Orbit::FormBuilder
+1 -1
View File
@@ -2,8 +2,8 @@ class AdBanner
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes include Mongoid::MultiParameterAttributes
include OrbitCoreLib::ObjectAuthable
include OrbitTag::Taggable include OrbitTag::Taggable
include OrbitModel::Authorizable
field :title field :title
field :transition_msec,type: Integer field :transition_msec,type: Integer
+12 -1
View File
@@ -5,13 +5,16 @@ class Asset
include OrbitTag::Taggable include OrbitTag::Taggable
mount_uploader :data, FileAssetUploader mount_uploader :data, FileAssetUploader
before_save :update_asset_attributes
field :filename field :filename
field :description, localize: true field :description, localize: true
field :title, localize: true field :title, localize: true
field :content_type
field :file_size
validates :title, :at_least_one => true validates :title, :at_least_one => true
validates :description, :at_least_one => true
validates_presence_of :data validates_presence_of :data
@@ -21,6 +24,14 @@ class Asset
before_save :clean_tags before_save :clean_tags
protected protected
def update_asset_attributes
if data.present? && data_changed?
self.content_type = data.file.content_type
self.file_size = data.file.size
end
end
def clean_tags def clean_tags
self.tagged_ids.delete('') self.tagged_ids.delete('')
+6
View File
@@ -0,0 +1,6 @@
class AuthApproval < Authorization
field :title
belongs_to :approval_authorizable, polymorphic: true
has_and_belongs_to_many :authorized_users, class_name: 'User', inverse_of: 'approving_apps'
end
+3
View File
@@ -0,0 +1,3 @@
class AuthManager < Authorization
has_and_belongs_to_many :authorized_users, class_name: 'User', inverse_of: 'managing_apps'
end
+6
View File
@@ -0,0 +1,6 @@
class AuthSubManager < Authorization
field :title
belongs_to :sub_manager_authorizable, polymorphic: true
has_and_belongs_to_many :authorized_users, class_name: 'User', inverse_of: 'sub_managing_apps'
end
+108
View File
@@ -0,0 +1,108 @@
class Authorization
include Mongoid::Document
include Mongoid::Timestamps
field :title
belongs_to :module_app
has_and_belongs_to_many :roles
has_and_belongs_to_many :sub_roles
delegate :update_auth_approval_users, :update_auth_manager_users, :update_auth_sub_manager_users, to: :module_app, prefix: true, allow_nil: true
after_save :update_module_app
def add_roles(roles)
users = []
roles = Array(roles)
add_operation(:roles, roles)
sub_roles = []
roles.each{|role| role.sub_roles.each{|sub_role| sub_roles << sub_role.id}}
add_operation(:sub_roles, sub_roles)
roles.each{|role| role.users.where(admin: false).each{|user| users << user}}
add_users(users, false)
end
def add_sub_roles(sub_roles)
users = []
sub_roles = Array(sub_roles)
add_operation(:sub_roles, sub_roles)
sub_roles.each do |sub_role|
self.roles << sub_role.role unless self.roles.include?(sub_role.role)
sub_role.users.where(admin: false).each{|user| users << user}
end
add_users(users, false)
end
def add_users(users, with_parents = true)
users = Array(users)
add_operation(:authorized_users, users)
users.each do |user|
user.roles.each do |role|
self.roles << role unless self.roles.include?(role)
end
user.sub_roles.each do |sub_role|
self.sub_roles << sub_role unless self.sub_roles.include?(sub_role)
end
end if with_parents
self.save
end
def remove_roles(roles)
users = []
sub_roles = []
roles = Array(roles)
remove_operation(:roles, roles)
roles.each do |role|
role.sub_roles.each{|sub_role| sub_roles << sub_role}
role.users.where(admin: false).each{|user| users << user}
end
remove_operation(:sub_role_ids, sub_roles)
remove_operation(:authorized_user_ids, users)
add_roles(self.roles)
end
def remove_sub_roles(sub_roles)
users = []
sub_roles = Array(sub_roles)
remove_operation(:sub_roles, sub_roles)
sub_roles.each do |sub_role|
users << sub_role.users.where(admin: false)
end
remove_operation(:authorized_user_ids, users)
add_roles(self.roles)
end
def remove_users(users)
users = Array(users)
remove_operation(:authorized_user_ids, users)
self.save
end
protected
def add_operation(db_field, objs)
objs.each do |obj|
self.send(db_field) << obj unless self.send(db_field).include?(obj)
end
end
def remove_operation(db_field, obj)
self.write_attribute(db_field, self.send(db_field) - obj.map{|y| y.id})
end
private
def update_module_app
case self._type
when "AuthApproval"
self.module_app_update_auth_approval_users
when "AuthManager"
self.module_app_update_auth_manager_users
when "AuthSubManager"
self.module_app_update_auth_sub_manager_users
end
end
end
+1 -1
View File
@@ -1,7 +1,7 @@
class Category class Category
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include OrbitCoreLib::ObjectAuthable include OrbitModel::Authorizable
field :disable, type: Boolean, default: false field :disable, type: Boolean, default: false
field :title, localize: true field :title, localize: true
-7
View File
@@ -1,7 +0,0 @@
class Ckeditor::Asset
include Ckeditor::Orm::Mongoid::AssetBase
delegate :url, :current_path, :size, :content_type, :filename, :to => :data
validates_presence_of :data
end
-7
View File
@@ -1,7 +0,0 @@
class Ckeditor::AttachmentFile < Ckeditor::Asset
mount_uploader :data, CkeditorAttachmentFileUploader, :mount_on => :data_file_name
def url_thumb
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
end
end
-7
View File
@@ -1,7 +0,0 @@
class Ckeditor::Picture < Ckeditor::Asset
mount_uploader :data, CkeditorPictureUploader, :mount_on => :data_file_name
def url_content
url(:content)
end
end
+11 -8
View File
@@ -45,15 +45,18 @@ class Item
end end
def shift_to(new_parent, position) def shift_to(new_parent, position)
unless self.parent_id.to_s.eql?(new_parent) && self.position.eql?(position.to_i) position = position.to_i
new_parent = Item.find(new_parent) new_parent = Item.find(new_parent)
current_position_sibling = find_by_parent_and_position(new_parent, position.to_i) current_position_sibling = find_by_parent_and_position(new_parent, position)
if current_position_sibling if current_position_sibling
move_above(current_position_sibling) if self.position > current_position_sibling.position
elsif self.parent != new_parent self.move_above(current_position_sibling)
self.parent = new_parent else
save self.move_below(current_position_sibling)
end end
elsif self.parent != new_parent
self.parent = new_parent
save
end end
end end
+67 -2
View File
@@ -1,16 +1,27 @@
class ModuleApp class ModuleApp
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
include OrbitCoreLib::ObjectTokenUtility # include OrbitCoreLib::ObjectTokenUtility
include OrbitApp::ModuleAppMembershipTools # include OrbitApp::ModuleAppMembershipTools
field :auth_approval_users, type: Array, default: nil
field :auth_manager_users, type: Array, default: nil
field :auth_sub_manager_users, type: Array, default: nil
field :has_category, type: Boolean, default: false
field :key field :key
field :title field :title
field :sidebar_order,type: Integer,default: 0 field :sidebar_order,type: Integer,default: 0
has_one :auth_manager, dependent: :destroy
has_many :auth_approvals, dependent: :destroy
has_many :auth_sub_managers, dependent: :destroy
has_many :categories, dependent: :destroy has_many :categories, dependent: :destroy
has_many :module_tags, dependent: :destroy has_many :module_tags, dependent: :destroy
has_many :approvals #to remove
delegate :authorized_users, to: :auth_manager, prefix: true, allow_nil: true
def refetch_setting!(reg) def refetch_setting!(reg)
# %w{module_label category base_url version organization author intro update_info create_date}.each do |field| # %w{module_label category base_url version organization author intro update_info create_date}.each do |field|
# self[field.to_sym] = reg.send field # self[field.to_sym] = reg.send field
@@ -24,6 +35,7 @@ class ModuleApp
self[:has_category] = reg.get_has_category self[:has_category] = reg.get_has_category
self[:is_approvable] = reg.get_is_approvable self[:is_approvable] = reg.get_is_approvable
self[:is_authorizable] = reg.get_is_authorizable self[:is_authorizable] = reg.get_is_authorizable
self[:approvable_models] = reg.get_approvable_models
self[:authorizable_models] = reg.get_authorizable_models self[:authorizable_models] = reg.get_authorizable_models
end end
@@ -168,4 +180,57 @@ class ModuleApp
self.module_tags.map{|t| t.tag } self.module_tags.map{|t| t.tag }
end end
# authorization
def update_auth_approval_users
user_ids = self.auth_approvals.inject([]) do |users, auth|
users += auth.authorized_users.map{|user| user.id}
end
self.update_attribute(:auth_approval_users, user_ids.uniq)
end
def update_auth_manager_users
users = self.auth_manager_authorized_users
self.update_attribute(:auth_manager_users, users.map{|user| user.id}) if users
end
def update_auth_sub_manager_users
user_ids = self.auth_sub_managers.inject([]) do |users, auth|
users += auth.authorized_users.map{|user| user.id}
end
self.update_attribute(:auth_sub_manager_users, user_ids.uniq)
end
def managers
auth_manager_authorized_users || []
end
def user_can_manage?(user)
managers.include?(user)
end
def is_manager?(user)
if user && !auth_manager_users.blank?
auth_manager_users.include?(user.id)
else
false
end
end
def is_sub_manager?(user)
if user && !auth_sub_manager_users.blank?
auth_sub_manager_users.include?(user.id)
else
false
end
end
def can_approve?(user)
if user && !auth_approval_users.blank?
auth_approval_users.include?(user.id)
else
false
end
end
end end
+2 -2
View File
@@ -30,8 +30,8 @@ class ModuleTag
if self.new_record? if self.new_record?
self.build_tag(name_translations: self.name_translations, is_default: self.is_default) self.build_tag(name_translations: self.name_translations, is_default: self.is_default)
else else
self.tag.name_translations = self.name_translations self.tag.attributes = {:name_translations => self.name_translations}
self.tag.is_default = self.is_default self.tag.attributes = {:is_default => self.is_default}
end end
end end
+9 -2
View File
@@ -12,8 +12,11 @@ class Site
field :private_key, :type => Binary field :private_key, :type => Binary
field :public_key, :type => Binary field :public_key, :type => Binary
field :frontend_closed, :type => Boolean, :default => false field :frontend_open, :type => Boolean, :default => true
field :backend_openness_on, :type => Boolean, :default => false field :backend_openness_on, :type => Boolean, :default => false
field :desktop_closed, :type => Boolean, :default => false
field :sitemap_menu_in_header, :type => Boolean, :default => false
field :enable_terms_of_use, :type => Boolean, :default => false
field :title_always_on, :type => Boolean, :default => false field :title_always_on, :type => Boolean, :default => false
field :dashbroad_allow_visitor, :type => Boolean, :default => false field :dashbroad_allow_visitor, :type => Boolean, :default => false
@@ -26,15 +29,19 @@ class Site
field :department field :department
mount_uploader :default_image, ImageUploader mount_uploader :default_image, ImageUploader
mount_uploader :favicon, ImageUploader
field :search,:type => Hash field :search,:type => Hash
field :resque_namespace,:type => String, :default=>APP_CONFIG['orbit'] field :resque_namespace,:type => String, :default=>APP_CONFIG['orbit']
field :title, localize: true field :title, localize: true
field :footer, localize: true field :footer, localize: true
field :sub_menu, localize: true field :sub_menu, localize: true
field :terms_of_use, localize: true
field :google_analytics
field :default_locale
field :mobile_on, :type => Boolean, :default => false field :mobile_on, :type => Boolean, :default => false
belongs_to :design belongs_to :design
has_many :site_metas, :autosave => true, :dependent => :destroy has_many :site_metas, :autosave => true, :dependent => :destroy
-5
View File
@@ -1,8 +1,3 @@
# class Tag < ProtoTag
# belongs_to :module_app
# end
class Tag class Tag
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
+28
View File
@@ -0,0 +1,28 @@
class PersonalPluginIntro
include Mongoid::Document
include Mongoid::Timestamps
# include OrbitCoreLib::ObjectAuthable
# include OrbitCoreLib::ObjectDisable
# has_and_belongs_to_many :users
belongs_to :user
field :text, localize: true
field :brief_intro, :type => Boolean, :default => false
field :complete_list, :type => Boolean, :default => true
def pp_object
brief_intro
end
def self.from_id(id)
PersonalPluginIntro.find(id) rescue nil
end
def self.is_localized?(field_name)
self.fields[field_name.to_s].localized?
end
end
+25 -9
View File
@@ -1,13 +1,15 @@
class User class User
include Mongoid::Document include Mongoid::Document
include Mongoid::Tree
include Mongoid::Tree::Ordering # use mongoid-tree because mongoid-ordering needs mongoid(~>3.0)
include Mongoid::Timestamps include Mongoid::Timestamps
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :validatable #, :timeoutable devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :validatable #, :timeoutable
mount_uploader :avatar, AvatarUploader mount_uploader :avatar, AvatarUploader
field :admin, :type => Boolean, :default => true field :admin, :type => Boolean, :default => false
field :active_role field :active_role
field :user_id field :user_id
field :sid field :sid
@@ -19,29 +21,38 @@ class User
field :cache_dept,type: Hash field :cache_dept,type: Hash
field :status_record,type: Hash field :status_record,type: Hash
has_and_belongs_to_many :approving_apps, class_name: 'AuthApproval', inverse_of: 'authorized_users'
has_and_belongs_to_many :managing_apps, class_name: 'AuthManager', inverse_of: 'authorized_users'
has_and_belongs_to_many :sub_managing_apps, class_name: 'AuthSubManager', inverse_of: 'authorized_users'
has_many :attribute_values, :autosave => true, :dependent => :destroy has_many :attribute_values, :autosave => true, :dependent => :destroy
has_many :app_auths,as: :privilege_apps,:inverse_of => :privilege_lists has_many :app_auths,as: :privilege_apps,:inverse_of => :privilege_lists
has_many :blocked_apps, :inverse_of => :blocked_users, :class_name => "AppAuth", :dependent => :destroy has_many :blocked_apps, :inverse_of => :blocked_users, :class_name => "AppAuth", :dependent => :destroy
has_many :privilege_apps, :inverse_of => :privilege_users, :class_name => "AppAuth", :dependent => :destroy has_many :privilege_apps, :inverse_of => :privilege_users, :class_name => "AppAuth", :dependent => :destroy
has_many :managing_apps,:class_name => "AppManager", :dependent => :destroy # has_many :managing_apps,:class_name => "AppManager", :dependent => :destroy
has_one :desktop, :autosave => true, :dependent => :destroy has_one :desktop, :autosave => true, :dependent => :destroy
has_one :facebook, :autosave => true, :dependent => :destroy has_one :facebook, :autosave => true, :dependent => :destroy
has_many :other_accounts, :autosave => true, :dependent => :destroy has_many :other_accounts, :autosave => true, :dependent => :destroy
has_many :assets, as: :assetable
# has_many :journals, :autosave => true, :dependent => :destroy # has_many :journals, :autosave => true, :dependent => :destroy
# has_many :papers, :autosave => true, :dependent => :destroy # has_many :papers, :autosave => true, :dependent => :destroy
has_and_belongs_to_many :sub_role_tags has_and_belongs_to_many :sub_role_tags
has_many :user_actions, :dependent => :destroy has_many :user_actions, :dependent => :destroy
has_many :personal_plugin_intro
# has_and_belongs_to_many :statuses # has_and_belongs_to_many :statuses
has_and_belongs_to_many :roles has_and_belongs_to_many :roles
has_and_belongs_to_many :sub_roles has_and_belongs_to_many :sub_roles
has_and_belongs_to_many :role_statuses has_and_belongs_to_many :role_statuses
has_and_belongs_to_many :role_categorys has_and_belongs_to_many :role_categorys
accepts_nested_attributes_for :attribute_values, :allow_destroy => true accepts_nested_attributes_for :attribute_values, :allow_destroy => true
before_create :initialize_desktop before_create :initialize_desktop
before_save :assign_default_position, :if => :assign_default_position?
before_save :rebuild_status_record before_save :rebuild_status_record
scope :remote_account, where(:nccu_id.ne => nil) scope :remote_account, where(:nccu_id.ne => nil)
scope :not_guest_user, all_of(:name.ne => "guest") scope :not_guest_user, all_of(:name.ne => "guest")
@@ -89,9 +100,9 @@ class User
var[:id].each do |id,val| var[:id].each do |id,val|
# binding.pry if id == '5052c5b22b5c49ab02000004' # binding.pry if id == '5052c5b22b5c49ab02000004'
if (val=="true") if (val=="true")
self.roles = self.roles.reject{|t| t.id.to_s==id} self.role_ids.reject!{|t| t.to_s == id}
elsif(val=="false") elsif(val=="false")
self.roles << Role.find(id) self.role_ids += Array(id)
end end
end end
end end
@@ -106,9 +117,9 @@ class User
# binding.pry if id == '5052c5b22b5c49ab02000004' # binding.pry if id == '5052c5b22b5c49ab02000004'
if ( self.roles.include?(@roid) == false or val=="true") if ( self.roles.include?(@roid) == false or val=="true")
self.sub_roles = self.sub_roles.reject{|t| t.id.to_s==id} self.sub_role_ids.reject!{|t| t.to_s == id}
elsif(val=="false") elsif(val=="false")
self.sub_roles << SubRole.find(id) self.sub_role_ids += Array(id)
end end
end end
@@ -273,13 +284,13 @@ class User
end end
def managed_module_apps def managed_module_apps
self.managing_apps.inject([]) do |managed_apps, app_manager| self.managing_apps.inject([]) do |managed_apps, auth_manager|
managed_apps << app_manager.managing_app unless app_manager.managing_app.blank? managed_apps << auth_manager.module_app
managed_apps managed_apps
end end
end end
protected private
def rebuild_status_record def rebuild_status_record
self.status_record = {} self.status_record = {}
@@ -289,4 +300,9 @@ class User
end end
end end
# override mongoid-tree's method
def assign_default_position?
!self['name'].eql?('guest') && (self.position.nil? || self.parent_id_changed?)
end
end end
Loaded 100 of 596 files, more files were not shown because too many files have changed in this diff. Show more