Compare commits

..

417 Commits

Author SHA1 Message Date
Harry Bomrah 592c8c63fe added fix for member_attributes text_area 2015-07-20 20:48:28 +08:00
Harry Bomrah 2ccabb64f3 fix for some edit rendering 2015-07-20 19:50:34 +08:00
Harry Bomrah 9ec5e21500 fix for fallback if site cant communicate to store and also fixed edit mode 2015-07-20 17:29:29 +08:00
Harry Bomrah f9dd55eea2 fixed chinese detection for url. 2015-07-17 14:53:50 +08:00
Harry Bomrah afe1ffd437 page id validations for link and normal page fixed. 2015-07-16 19:42:05 +08:00
Harry Bomrah 898059c6d2 small fixes for various stuff 2015-07-15 14:00:48 +08:00
Harry Bomrah 8b8dd22e88 small bug fix for feeds if feed module is not present. 2015-07-09 14:20:49 +08:00
Harry Bomrah bead39d5b4 small fix 2015-07-08 20:17:30 +08:00
Harry Bomrah 93d66b5866 fix for meember role disabled fields and also role will delete all the attribute fields 2015-07-08 20:00:59 +08:00
Harry Bomrah 59a198005d added some stuff for feeds and utility 2015-07-07 19:55:46 +08:00
Harry Bomrah f7c377d092 allow ip in url for links 2015-07-06 18:36:14 +08:00
Harry Bomrah 1951c581a2 added meta tag mechanism for facebook 2015-07-03 19:52:05 +08:00
Harry Bomrah b2056a2ad5 some test mods for feeds 2015-07-01 15:13:28 +08:00
Harry Bomrah 251133748d fixed zh-cn conversion and also back page from page not available page. 2015-06-25 17:38:23 +08:00
Harry Bomrah 5acfed083a validation for links 2015-06-25 17:02:50 +08:00
Harry Bomrah afde19052e added default hash for links 2015-06-25 15:27:29 +08:00
Harry Bomrah e168b01f9b added page not available in language page. 2015-06-25 13:31:05 +08:00
rulingcom dd3b4f0384 sdk update for groups and orbit_bootstrap by joshua 2015-06-24 18:09:59 +08:00
Harry Bomrah 4068d8488a language switch for orbit bar can be enabled or disabled from backend. 2015-06-24 18:00:09 +08:00
Harry Bomrah 94f1de8de9 changed fields for member roles 2015-06-24 16:54:44 +08:00
Harry Bomrah 3dc625e34f modified dob for member profile 2015-06-24 01:38:12 +08:00
rulingcom ed24126648 joshuas update for sdk and grou 2015-06-05 19:05:01 +08:00
Harry Bomrah cfda81a546 added site bar settings for logo and title in frontend, fixed role status disbale enable and also added br to text area 2015-06-05 18:55:28 +08:00
Harry Bomrah e594d345cc added sync and sorting for members 2015-06-05 14:21:34 +08:00
rulingcom 25eb95672a joshua mods for calendar accessbility 2015-06-03 18:17:58 +08:00
Harry Bomrah 76c2048a29 small fix 2015-06-02 20:13:30 +08:00
Harry Bomrah b729e32258 now default modules will be automatically authorized after registering of website. 2015-06-02 19:54:23 +08:00
Harry Bomrah 2508d70883 calendar widget and frontend fix 2015-06-02 17:22:05 +08:00
Harry Bomrah 5977370c98 groups member now available 2015-06-01 16:17:45 +08:00
rulingcom a3033c548b mods by joshua for groups and calendar and etc sdk 2015-06-01 16:15:07 +08:00
rulingcom 822a6932cd joshuas update for groups 2015-05-28 21:19:58 +08:00
Harry Bomrah 1f25dbdfec version added for mongoid 2015-05-28 20:10:26 +08:00
rulingcom 98ec676197 joshua commit for groups and orbit bar again 2015-05-28 14:27:27 +08:00
Harry Bomrah e8b727af01 group mods for edit post 2015-05-28 14:19:55 +08:00
Harry Bomrah 2fc15eab29 xss issue fixed 2015-05-26 16:02:16 +08:00
Harry Bomrah d26a5bedb7 added members page to groups 2015-05-26 15:00:24 +08:00
rulingcom 8099a79918 joshua update for groups and orbit bar 2015-05-26 14:13:38 +08:00
Harry Bomrah c406951876 delete post, edit groups done 2015-05-23 03:48:07 +08:00
Harry Bomrah a440076916 fix orbit bar css for the software 2015-05-20 21:13:39 +08:00
Harry Bomrah 8dac8273f7 group mods.. 2015-05-20 14:17:00 +08:00
rulingcom 017be3eb3d joshua commit for groups, sdk and orbit_bar 2015-05-18 16:26:22 +08:00
Harry Bomrah 3772e350ba now can insert word to ckeditor directly and also fixed looping problem for freego software. 2015-05-15 21:33:11 +08:00
Harry Bomrah 451176b068 text with number of counts 2015-05-13 15:36:42 +08:00
Harry Bomrah 694f839217 added edit mode button in frontend 2015-05-12 17:30:45 +08:00
Harry Bomrah a160c6b020 child page relocation fixed 2015-05-12 15:51:33 +08:00
Harry Bomrah bd7e29773f fix small bug for creating member
Please enter the commit message for your changes. Lines starting
2015-05-12 14:08:21 +08:00
Harry Bomrah 6ff99124fd member profile creation fixed 2015-05-11 19:30:03 +08:00
Harry Bomrah 7180b94bd6 fix language sitemap name 2015-05-05 20:03:09 +08:00
Harry Bomrah 7654fc7f23 language in orbit bar fixed 2015-05-05 18:08:57 +08:00
Harry Bomrah 4638b4bca9 downloaded extensions added 2015-04-30 21:08:52 +08:00
Harry Bomrah f17f847dbd url validation added. 2015-04-30 20:32:53 +08:00
Ruling-iMac d386174c97 add function : redirect to homepage 2015-04-30 18:31:40 +08:00
Harry Bomrah 927b08edeb fix main forms css and a user profile bug 2015-04-30 14:38:36 +08:00
Harry Bomrah 83656d2362 small fix for member show page 2015-04-29 17:34:57 +08:00
Harry Bomrah 5935a91795 changed member to community 2015-04-28 22:47:56 +08:00
Harry Bomrah ae785defc2 groups version 2.0 2015-04-28 22:24:25 +08:00
rulingcom 804030751f big commit from joshua for orbit_bootstrap sdk and groups 2015-04-28 18:34:40 +08:00
Harry Bomrah 70bbe6ac5a fix for table layout for members 2015-04-28 18:23:59 +08:00
Harry Bomrah b5d2d7736c authorization fix for create and update of plugins 2015-04-28 17:54:49 +08:00
Harry Bomrah a20d446283 cant select empty value in page parts 2015-04-28 15:48:15 +08:00
Harry Bomrah 083b6ace78 removed mobile settings and also removed bundle update from server 2015-04-27 21:39:46 +08:00
Harry Bomrah 057f689526 page id cannot be chinese and also some module update fixes 2015-04-27 20:45:05 +08:00
Harry Bomrah 0380972e5b small fix for member fields display 2015-04-23 17:19:10 +08:00
Harry Bomrah c39ca8c360 sorting for role status fixed 2015-04-22 23:05:17 +08:00
Harry Bomrah 37c28fd03e adding routes file 2015-04-22 22:58:10 +08:00
Harry Bomrah 997a3afd93 now can add or delete fields for the member 2015-04-22 22:51:30 +08:00
Harry Bomrah cf7e15d4bb user friendly for editing members 2015-04-22 18:28:14 +08:00
Harry Bomrah db88b1e553 fixed bug in members frontend and also roles and role statuses sorted on key ascending 2015-04-22 16:30:58 +08:00
Harry Bomrah 573030b119 removed update all button 2015-04-21 17:40:48 +08:00
Harry Bomrah b1be711fd5 module update stuff added to kernel 2015-04-21 17:19:00 +08:00
Harry Bomrah 25c612ac9e modified debugging for frontend 2015-04-17 15:54:32 +08:00
Harry Bomrah 54eb8ee766 debug added for modules and widgets frontend 2015-04-15 13:39:46 +08:00
Harry Bomrah a481be0694 rails menu cache removed 2015-04-14 16:57:44 +08:00
Harry Bomrah ec4f54fcc4 mongoid fix 2015-04-14 16:18:44 +08:00
rulingcom 5aac9b297d merged 2015-04-14 15:31:41 +08:00
Harry Bomrah 1cfd6b80f9 lot of changes for groups 2015-04-14 15:18:58 +08:00
Harry Bomrah 7e46bde3bc fix error for page submit 2015-04-10 18:38:25 +08:00
Harry Bomrah 1fadefa510 fix for cache clear on page part submit 2015-04-10 16:33:47 +08:00
Harry Bomrah 15fec35e3f groups multifile added and show page working. 2015-04-01 01:02:01 +08:00
rulingcom 60bb2cac1e group mods by joshua 2015-03-31 15:51:44 +08:00
Harry Bomrah be61b4488e temp ignore cache 2015-03-30 18:12:23 +08:00
Harry Bomrah 73147223f8 added downloaded_extension file 2015-03-30 16:48:02 +08:00
Harry Bomrah 35eaf325f2 downloaded extension lock removed 2015-03-30 15:35:38 +08:00
Harry Bomrah 90eba5141e removed lock file 2015-03-30 15:19:01 +08:00
Harry Bomrah 6d06790159 added expire time to cache. 2015-03-30 15:13:45 +08:00
Harry Bomrah 27222ab6cd small fix for cache 2015-03-30 15:13:37 +08:00
Harry Bomrah 8b2281ca17 now the caching initialized with engine
Conflicts:
	Gemfile
2015-03-30 15:12:41 +08:00
manson 3262359911 update impression and add cache for page sub-parts, main-menu 2015-03-30 15:11:26 +08:00
Harry Bomrah 4b770b7fd1 group create fix 2015-03-25 15:50:58 +08:00
Harry Bomrah b290d3653f groups commit 2015-03-25 15:46:11 +08:00
rulingcom e1c8d61195 sdk precompile fixed 2015-03-23 17:39:58 +08:00
rulingcom f9ed19def0 Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 into development 2015-03-23 13:25:13 +08:00
Harry Bomrah f52919e4b6 group added 2015-03-19 14:24:40 +08:00
Harry Bomrah 2432a587d5 css mods for archive 2015-03-18 17:59:36 +08:00
Harry Bomrah fb8c8d4526 fixed omniauth 2015-03-18 15:41:24 +08:00
rulingcom 20350c4e14 Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 into development 2015-03-13 17:13:35 +08:00
Harry Bomrah 52c78856be added insert new widgets to kernel 2015-03-13 16:39:09 +08:00
rulingcom 338824a509 addes bootstrap back 2015-03-12 19:06:42 +08:00
Harry Bomrah c4be6c5f63 visibility of group fixed 2015-03-12 19:05:49 +08:00
Harry Bomrah f71b5d6bbb groups started 2015-03-12 19:02:48 +08:00
rulingcom 16dae228b1 sdk updates from joshua 2015-03-11 16:18:56 +08:00
Harry Bomrah 9be667d405 removed desktop 2015-03-06 18:03:43 +08:00
rulingcom e045025bc6 precompile fixes for orbit mobile template 2015-03-06 17:59:30 +08:00
rulingcom 7aa187497a sdk changes by joshua wq 2015-03-06 17:21:38 +08:00
Harry Bomrah dfd7865bd5 new error and success pages for google auth and also spinner fixed for update manager 2015-03-06 17:13:09 +08:00
Harry Bomrah e881d02bee fix 2015-03-04 20:43:01 +08:00
Harry Bomrah b53a7508f5 again small fix for js
Conflicts:
	app/views/admin/members/show.html.erb
2015-03-04 20:37:44 +08:00
Harry Bomrah 8e7319b3c3 fixed js 2015-03-04 20:31:33 +08:00
Harry Bomrah 2942ab8563 small fix in js for google connect 2015-03-04 20:17:39 +08:00
Harry Bomrah ed3308abbb google oauth added and also preferences 2015-03-04 18:31:36 +08:00
Harry Bomrah 5773d49218 small fix for datepicker 2015-02-26 14:53:55 +05:30
Harry Bomrah 3e1032f801 fixed date and time for announcement and news 2015-02-26 14:53:55 +05:30
Ray eb21f6535c store css 2015-02-26 15:11:38 +08:00
Ray 5f90be20a2 update Templates storn & Module storn UI 2015-02-26 15:09:42 +08:00
Ray d64dc336a5 use CDN
change jquery, Bootstrap and font-awesome url to CDN
2015-02-26 15:06:45 +08:00
Ray aef48fe890 Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 into development 2015-02-26 15:01:31 +08:00
Ray f3e9679e54 增加右上角的新增按鈕
使用方式是當 render filter 在最後放個 true
範例:<%=  render_filter @filter_fields, "index_table", true %>
2015-02-26 15:01:06 +08:00
JiangRu 17213fb41f if no data , hide title&table 2015-02-25 11:06:58 +08:00
Harry Bomrah 8c0d94c00a Merge branch 'master' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 into development 2015-02-09 15:13:52 +05:30
Harry Bomrah 9862722252 url fixed for license 2015-02-09 15:09:16 +05:30
manson 1aa5739380 add all JS and CSS to precompile 2015-02-06 18:05:05 +08:00
manson 0c62c4b994 fix development mode not using precompiled aseets 2015-02-06 17:36:37 +08:00
Harry Bomrah e1247e6083 Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 2015-01-20 14:24:17 +05:30
spen e616c4b947 fix member pic name 2015-01-20 15:27:43 +08:00
Harry Bomrah 1b4e975548 Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 2015-01-12 12:25:20 +05:30
Harry Bomrah 35e203c476 fix 2015-01-12 12:24:28 +05:30
Harry Bomrah 4fd0e2d315 Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 2015-01-12 12:20:52 +05:30
Harry Bomrah 3532ec67a9 some error fixed for checking permissions 2015-01-12 12:19:52 +05:30
Harry Bomrah 9be7e13774 Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 2015-01-12 11:54:52 +05:30
Harry Bomrah 328277394d fix for rake... 2015-01-12 11:53:29 +05:30
Harry Bomrah e824e23e0a Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 2015-01-09 17:32:06 +08:00
spen 92575e01fa fix member plugins 2015-01-09 16:13:17 +08:00
Harry Bomrah da06328013 Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 2015-01-08 23:05:22 +08:00
Harry Bomrah 5087a54daa fixed a small bug with no categories enabled. 2015-01-08 23:04:14 +08:00
rulingcom 6b469e78fd info json added to gallery 2015-01-07 16:09:47 +08:00
Harry Bomrah fea7113cd1 removed joshua from db 2015-01-07 15:02:00 +08:00
rulingcom 1c65e90699 small fix 2015-01-06 15:46:39 +08:00
rulingcom f1acfa34ac template default modified 2015-01-06 15:23:29 +08:00
Harry Bomrah 12107376b6 fix for restarting server 2014-12-31 16:41:47 +08:00
Harry Bomrah ceca2c58c0 fix for module permissions 2014-12-31 16:33:33 +08:00
Harry Bomrah 343294858e fix for non registered site and module update button 2014-12-31 15:27:18 +08:00
JiangRu 487d84c1d1 help designer's to push code 2014-12-31 15:16:24 +08:00
JiangRu 4425063a68 add module update button 2014-12-31 15:13:49 +08:00
JiangRu 76397de5ef fix member list 2014-12-31 10:11:39 +08:00
Ray 380e2cd4f9 License Denied. 2014-12-30 20:40:45 +08:00
Harry Bomrah 6e27bbd483 module store changes 2014-12-30 18:38:11 +08:00
Harry Bomrah 31c8892525 Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 2014-12-28 14:44:27 +08:00
Harry Bomrah c8d395aca1 fixed tags and also some store commits 2014-12-28 14:43:34 +08:00
Harry Bomrah f687a8f9ad Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 2014-12-26 16:56:15 +08:00
Harry Bomrah 4575fce2a9 counter added and also some changes for store 2014-12-26 16:55:28 +08:00
JiangRu aac9135149 member plugin front page show 2014-12-26 16:23:51 +08:00
JiangRu 207fc9c0f8 fix member plugin intro or complete list & fix journal all author 2014-12-26 16:20:47 +08:00
JiangRu 71ea2eb2dd fix menu tag 2014-12-26 10:26:40 +08:00
JiangRu 6de00652fe fix member plugin intro or complete list 2014-12-22 11:46:27 +08:00
Harry Bomrah ed13c81880 Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 2014-12-19 17:53:55 +08:00
Harry Bomrah e3e15a1ef2 fix for all members 2014-12-19 17:53:24 +08:00
Harry Bomrah 0e7e4180a6 Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 2014-12-19 17:15:36 +08:00
Harry Bomrah fc184a7cea fix for members category 2014-12-19 17:14:31 +08:00
Harry Bomrah f9f4224a5b calendar removed from built in 2014-12-19 16:36:44 +08:00
Harry Bomrah f62b3c7ae4 Merge branch 'development' of gitlab.tp.rulingcom.com:saurabh/orbit4-5 2014-12-19 16:35:02 +08:00
Harry Bomrah 2402f953f0 fixed member categories all problem 2014-12-19 16:33:23 +08:00
Harry Bomrah e21ad257ff some changes in sdk for ad_banner 2014-12-18 20:04:38 +08:00
JiangRu 2ae34f1cbc fix journal all author 2014-12-18 16:08:34 +08:00
Harry Bomrah 6e7b737b47 added calendar to built in extensions 2014-12-17 20:29:00 +08:00
Harry Bomrah 1da348f747 some mods for calendar 2014-12-16 19:34:29 +08:00
Harry Bomrah adbbd044ef import modified 2014-12-11 15:01:42 +08:00
Harry Bomrah b11299a667 import modified 2014-12-10 19:28:40 +08:00
Harry Bomrah 4415093ce2 lot of fixes and experience enhancement 2014-12-10 18:09:50 +08:00
Harry Bomrah 05852ed09f category enhancements 2014-12-09 22:00:40 +08:00
Harry Bomrah e521e1ea26 some category disable improvements 2014-12-09 21:25:51 +08:00
Harry Bomrah fb9b1ede40 added version file 2014-12-09 16:48:18 +08:00
Harry Bomrah 3a836ad9c5 taggable modified for faster performance 2014-12-08 18:53:27 +08:00
Harry Bomrah 8b7a139dc2 module page modified 2014-12-08 18:29:21 +08:00
Harry Bomrah 934edc5f81 removes uninstalled modules and also attemp to bundle install fast 2014-12-08 18:11:10 +08:00
Harry Bomrah 8b2e88be0a added is user sub manager 2014-12-08 15:52:37 +08:00
Harry Bomrah 075ae1b135 site type added 2014-12-08 15:08:59 +08:00
rulingcom 5c33fa0ddb sdk changes 2014-12-08 14:54:40 +08:00
Harry Bomrah 36f7e19011 fixed assets for ckeditor 2014-12-03 15:08:01 +08:00
Harry Bomrah a89e06087a store registration form changes 2014-12-02 21:10:15 +08:00
Harry Bomrah e791339c4e fix for frontend authorization 2014-12-01 22:00:42 +08:00
Harry Bomrah 79554de201 edit button 2014-12-01 21:40:15 +08:00
Harry Bomrah 59d491c199 change for edit url in frontend 2014-12-01 21:17:20 +08:00
Harry Bomrah 4712a1f4ff test 3 2014-12-01 19:41:53 +08:00
Harry Bomrah 8663cf3699 fix for update manager 2014-12-01 19:40:48 +08:00
Harry Bomrah d0f35af7d5 test 2 2014-12-01 19:39:08 +08:00
Harry Bomrah 4511b11d99 fix for update manager 2014-12-01 19:37:59 +08:00
Harry Bomrah a33022cb4f test for update manager 2014-12-01 19:35:12 +08:00
Harry Bomrah 0526b5f9e7 update manager fix 2014-12-01 19:32:09 +08:00
Harry Bomrah 4b13800007 some update for page settings 2014-12-01 19:11:40 +08:00
Harry Bomrah ed36c3a48f added category to page model 2014-12-01 18:07:23 +08:00
Harry Bomrah 5e789bd473 fix for multi language 2014-12-01 15:06:26 +08:00
Harry Bomrah ff17799e83 small fix 2014-12-01 14:48:39 +08:00
Harry Bomrah eeebed8d7b small fix 2014-11-27 18:28:37 +08:00
Harry Bomrah 179a14d717 fixed url target issue 2014-11-27 18:19:43 +08:00
Harry Bomrah 03822379b2 small fix for page render 2014-11-27 18:09:18 +08:00
Harry Bomrah 0623541d94 now only registered websites can update via update manager 2014-11-24 18:21:00 +08:00
rulingcom 466f08d4f6 second check 2014-11-24 18:00:13 +08:00
rulingcom a17a5aeb8b test commit for access check 2014-11-24 16:44:32 +08:00
Harry Bomrah fc90ab47a4 activity and survey removed by default 2014-11-24 14:06:47 +08:00
Harry Bomrah 212f612e3e fixed uri parsing and also some page controller changes 2014-11-21 17:25:02 +08:00
Harry Bomrah d58090816e fix for language 2014-11-20 17:36:37 +08:00
Harry Bomrah 57681de065 added spens module to gem file 2014-11-20 17:13:25 +08:00
Harry Bomrah 97b4ad95e0 fix for language while creating pages 2014-11-20 17:06:15 +08:00
Harry Bomrah a1df9c5af3 some changes for desktop 2014-11-18 19:08:17 +08:00
Harry Bomrah f3000d1947 added active and survey module templates 2014-11-17 18:20:10 +08:00
Harry Bomrah 46ec4be6a2 optimization for authorization 2014-11-13 21:50:08 +08:00
Harry Bomrah 58bea99430 fixed authorizations 2014-11-13 19:50:19 +08:00
Harry Bomrah 26192b8757 git ignore file updated 2014-11-13 16:43:00 +08:00
rulingcom b5233da7e8 removed script form html sdk 2014-11-13 16:35:29 +08:00
Harry Bomrah f13312ddb6 mod for ad_banner 2014-11-13 16:31:10 +08:00
spen d836ded7f3 fix member frontend show fields 2014-11-13 11:56:50 +08:00
rulingcom 63b08335fa sdk changes 2014-11-12 19:00:18 +08:00
Harry Bomrah bbe44022c4 html_safe rendering 2014-11-12 16:17:08 +08:00
spen fa5ba42034 Add Active Event frontend index page 2014-11-10 10:40:35 +08:00
Harry Bomrah 3a1fb9c72b fix for pagination and also added data-module in body 2014-11-05 17:25:28 +08:00
Harry Bomrah e73ebe9037 some update for announcement_widget_link template 2014-11-04 15:53:03 +08:00
Harry Bomrah 0e2bd7b71f a small fix for locales for ajax 2014-11-03 20:39:16 +08:00
Harry Bomrah 067f7b18e5 added some method in orbit helper and some mods 2014-11-03 20:00:59 +08:00
Harry Bomrah 2404e117d0 fixed template change script 2014-11-03 14:12:20 +08:00
Harry Bomrah 966b6ec919 added override method for widgets frontend 2014-10-31 13:41:16 +08:00
Harry Bomrah 9da0c9f380 small member fix 2014-10-29 21:27:53 +08:00
Harry Bomrah 9eebd2ff51 store for module store 2014-10-28 19:18:59 +08:00
Harry Bomrah 99305b19ca small fix store 2014-10-28 18:18:06 +08:00
Harry Bomrah eb6a48bc84 small fix 2014-10-28 18:15:10 +08:00
Harry Bomrah 59731acccf UX enhancement for module store 2014-10-28 18:08:23 +08:00
Harry Bomrah 9d42b6fcda store url fix 2014-10-28 17:59:41 +08:00
Harry Bomrah d65df694a5 fixed js for email resend button 2014-10-28 17:56:58 +08:00
Harry Bomrah 75d8c46576 module store 2014-10-28 16:46:11 +08:00
Harry Bomrah 12b38691b0 url change for store 2014-10-27 19:10:42 +08:00
Harry Bomrah 5766c6355f orbit store integration 2014-10-27 19:07:01 +08:00
Harry Bomrah 50582cdbd8 back to in use locales for pages and links 2014-10-24 15:15:13 +08:00
Harry Bomrah a81f7576b6 trying to restart the server after language change 2014-10-24 14:49:23 +08:00
Harry Bomrah bc95f77f87 small fix 2014-10-23 18:32:13 +08:00
Harry Bomrah 11caff4b81 fixed forms for link and page for language use 2014-10-23 18:28:02 +08:00
Harry Bomrah 97e8aaea2b fix for no modules and added gotcha for ask module 2014-10-23 17:07:01 +08:00
Harry Bomrah 24b24ad760 fix for member import save.. removed validation 2014-10-22 15:20:43 +08:00
Harry Bomrah 0cff91594c member update modified and h2 tag in orbit bar 2014-10-22 14:51:14 +08:00
Harry Bomrah 384cc4d6f4 fix for chinese simplified and also new user added 2014-10-21 15:27:43 +08:00
Harry Bomrah 051b165298 fixed orbit bar lanugage and menu 2014-10-20 19:50:16 +08:00
Harry Bomrah 9c19a4a2fd added non approved users can view profile and not rest of system 2014-10-20 18:50:36 +08:00
Harry Bomrah 6473abeb44 added deadline and postdate to announcement upgrades 2014-10-17 18:24:03 +08:00
Harry Bomrah 78839a64d0 removed rulingcom user from user list 2014-10-16 19:55:32 +08:00
Harry Bomrah b4533a1720 fix for upgrading 4.2 to 4.5 2014-10-16 18:35:23 +08:00
Harry Bomrah e27192295d user save bug fixed 2014-10-16 15:14:37 +08:00
Harry Bomrah 4b302c8b2a added rake for orbit 4.2 upgrade 2014-10-15 20:43:35 +08:00
Harry Bomrah 1f088692aa new member password restriction removed 2014-10-15 17:13:32 +08:00
Harry Bomrah 1704232814 new json for announcement 2014-10-15 16:10:46 +08:00
Harry Bomrah 6cdd2a7c87 fix for page setting page for old stuff 2014-10-15 16:07:01 +08:00
Harry Bomrah 3ca0f399ec fixed username and password to be blank, user cant edit username and also the page setting options 2014-10-15 15:57:58 +08:00
Harry Bomrah d0781dea4a imported announcements are now by default approved 2014-10-14 17:08:06 +08:00
spen 0507d9d856 add member controller for Excel Import Members 2014-10-14 10:58:32 +08:00
Harry Bomrah 24a07a5780 widget title and page title fixed for page 2014-10-13 18:04:51 +08:00
Harry Bomrah c4cd4fd707 fixed sitemap translation 2014-10-13 16:28:00 +08:00
spen d4df227811 fixed orbit mailer for no file title 2014-10-13 15:25:30 +08:00
spen b33c2d5b38 Excel Import Members 2014-10-13 14:27:01 +08:00
Harry Bomrah 947da85563 fixed sorting problem for memebers 2014-10-09 18:02:42 +08:00
Harry Bomrah ddb457baab fix 2014-10-08 18:57:40 +08:00
Harry Bomrah a32e644297 fixed built_in_extension for desktop 2014-10-08 18:52:53 +08:00
Harry Bomrah f2de4eb0e3 a small fix for no chinese translations 2014-10-08 18:30:54 +08:00
Harry Bomrah f3dd0b8295 modified select scss.. 2014-10-08 17:11:02 +08:00
spen 6af19a2fda Add Survey frontend index page 2014-10-08 09:55:51 +08:00
Harry Bomrah 1467eb039d fixed filemanager.js for urls 2014-10-06 18:43:44 +08:00
Harry Bomrah f630596edc frontend access level bug fix 2014-10-06 18:00:41 +08:00
Harry Bomrah 0bd8680d62 git fixed tag module for taggable 2014-10-03 19:36:41 +08:00
Harry Bomrah e89fd7c30e fix for page date for sdk 2014-10-01 19:37:18 +08:00
Harry Bomrah c0fe4d9b2a fixed a small research file bug in import 2014-10-01 18:08:05 +08:00
Harry Bomrah c2fe693ceb date formating made easy for designers and also sitemap style changed 2014-10-01 16:12:38 +08:00
Harry Bomrah 9288d66660 fixed member view bug in member list page for imported members without user account 2014-09-30 13:27:37 +08:00
Harry Bomrah a73098dc8f clean button removed coz of 502 issues 2014-09-29 21:37:59 +08:00
rulingcom a2398ed6d9 added new types for announcment module widgets 2014-09-29 21:26:19 +08:00
Harry Bomrah c18846b6b0 added clean button for the modules import 2014-09-29 21:21:41 +08:00
Harry Bomrah cbd3a79122 fixed a small bug in sitemap 2014-09-26 18:58:55 +08:00
Harry Bomrah 788897deab fixed version of minimagick.. less buggy i suppose 2014-09-26 18:51:15 +08:00
Harry Bomrah 23bead2b5d fixed problem of sitemap sorting and also import modules dont go back after importing. also added sitemap for google crawler. 2014-09-26 17:10:17 +08:00
Harry Bomrah 72c8d4917b fixed non approved member bug in list page 2014-09-25 18:52:54 +08:00
Harry Bomrah fe1a87aae4 important update with some fixes in member import and also site preferences and page imports 2014-09-25 17:57:46 +08:00
Harry Bomrah 5b3b009f65 fix for high security bugs in report and plus some other member area fixes 2014-09-23 17:06:17 +08:00
Harry Bomrah b28597d16a added access level method to orbithelper 2014-09-22 16:34:22 +08:00
Harry Bomrah f6d29e128d skip announcement with no category 2014-09-19 13:58:30 +08:00
Harry Bomrah cac23e3c52 fixed a bug in js 2014-09-17 19:57:47 +08:00
Harry Bomrah eaf5fbbc8e import bugs removed for no data 2014-09-17 19:51:04 +08:00
Harry Bomrah e558b916fe fixed widget text image insert problem with chinese and also page import is changed to per page 2014-09-17 17:25:47 +08:00
Harry Bomrah b94f3ca2a1 fixed insert image problem in text for widget 2014-09-16 22:28:48 +08:00
Harry Bomrah 55483420cb builtinextension modified. 2014-09-15 15:34:30 +08:00
Harry Bomrah 5d6f33c90b added new 404 page and also fixed member import 2014-09-15 15:29:53 +08:00
manson 424d3fa559 fix member first/last name display order for zh_tw 2014-09-12 14:39:38 +08:00
manson ef55afceae update site search setting 2014-09-11 19:08:39 +08:00
Harry Bomrah 856b590e1b fixed delete and update user issue and also the language switch 2014-09-11 18:19:48 +08:00
manson 2c06c03f4d change member form first/last name position for zh_tw 2014-09-10 19:26:03 +08:00
manson 29c3394873 fix template index page title 2014-09-10 10:17:08 +08:00
manson 84a11d6e67 fix some issue in import_controller 2014-09-05 18:36:37 +08:00
manson 3dafcf37bc rescue import_controller import_status file not found 2014-09-03 18:57:28 +08:00
manson f4635502ef fix announcement template index page-title 2014-09-03 15:00:51 +08:00
Harry Bomrah 883fb31966 added desktop to user 2014-09-02 21:20:13 +08:00
Harry Bomrah ee6456a16a changed assets upload dirctory to public/uploads 2014-09-01 17:58:55 +08:00
Harry Bomrah 8e37fc33f4 changed upload directory to uploaded_assets from assets in public folder 2014-09-01 17:41:11 +08:00
manson 8bdc32ec30 change unicorn num of workers to num of cpu cores 2014-08-29 15:40:58 +08:00
manson 35ada57dbb update orbit_cron for multiple ruby version on server 2014-08-29 10:21:00 +08:00
manson 902ebfc775 update orbit_cron rake 2014-08-28 17:48:32 +08:00
manson e39fac0579 fix site initialization selecting template 2014-08-26 17:48:05 +08:00
manson a01d68e721 remove template orbit-classic 2014-08-26 16:30:42 +08:00
manson c07bb22308 update ruby version and added gems for js runtime 2014-08-26 12:10:54 +08:00
manson 7aeb81c532 Replace debugger to Byebug for ruby 2.1.2 or higher 2014-08-20 16:32:05 +08:00
manson 6851051af5 fix update manager check update 2014-08-20 16:15:49 +08:00
manson 561a8b210b create workgroups in environment.rb 2014-08-20 16:10:14 +08:00
manson 3f15d8102c fix page model assign_page_number method for empty database 2014-08-19 12:17:00 +08:00
manson 3609fab32a update built_in_extensions git url to http 2014-08-19 12:05:20 +08:00
manson ebabf7de01 disable preload_app of unicron, possible fix for random errors 2014-08-15 19:39:28 +08:00
manson a8a092a395 fix update manager 2014-08-15 17:47:14 +08:00
manson 39cb82e83d fix site structure main-enable checkboxes 2014-08-15 12:08:43 +08:00
manson 3435a7bfd3 update login redirect to referer url and fix check_user_can_use method 2014-08-15 10:29:17 +08:00
manson fb8d36fc35 update for ad_banner 2014-08-14 19:08:25 +08:00
manson 37dae67cbe fix template announcement info.js 2014-08-12 15:39:04 +08:00
manson 04272588d3 hide html element with class name "ui-helper-hidden-accessible" 2014-08-12 12:18:22 +08:00
manson 9d4ed9a6ab Add new widget method for announcement 2014-08-12 11:39:20 +08:00
manson 580d0f26aa fix import_controller missing fields 2014-08-11 20:09:44 +08:00
Harry Bomrah a1fb6ebd68 added template json for title key author 2014-08-11 16:02:58 +08:00
manson 7dd2c25180 fix jquery-ui-sortable path 2014-08-11 11:07:55 +08:00
manson 308b4ec1a5 fix KeywordConstraint 2014-08-11 10:59:03 +08:00
manson 285335b0c3 fix member edit_privilege authorization 2014-08-08 18:41:49 +08:00
manson ced6643246 fix member check_aceess_rights 2014-08-08 18:37:33 +08:00
manson b098904192 fix built_in_extensions.rb 2014-08-08 18:32:09 +08:00
manson 4be2993a9a fix member edit_password authorization 2014-08-08 18:29:44 +08:00
Harry Bomrah bbc171fc7c desktop mods with new layout stuff 2014-08-08 18:08:26 +08:00
Ray df934ae584 desktop mods
Conflicts:
	config/routes.rb
2014-08-08 18:08:26 +08:00
manson e19816ede5 fix member password note and birthday format 2014-08-08 16:41:31 +08:00
manson c2c9bd4682 update dashboard for better performance 2014-08-08 14:16:03 +08:00
manson 5f50d59333 fix switch_language 2014-08-08 11:46:21 +08:00
manson b4e5d36cc3 update backend search for modules 2014-08-07 18:44:23 +08:00
manson 68e0fbcd92 update backend search js 2014-08-07 14:20:22 +08:00
manson c656720132 search for module backend 2014-08-06 19:36:53 +08:00
Harry Bomrah a52239b135 a small link click bug fixed 2014-08-06 18:37:02 +08:00
Harry Bomrah 56e18cd040 fixed authorization bug and also added select and deselect for member selection 2014-08-06 18:27:54 +08:00
Harry Bomrah e320fa848d authorization completed .. select all button for member select is left 2014-08-05 21:51:05 +08:00
manson 14bfbe2d8a update ModuleApp and OrbitWidget registration 2014-08-05 18:22:36 +08:00
manson 43e1a669d6 fix a Ruby issue 2014-08-05 15:53:08 +08:00
manson 2ca408294e Add link_to_edit for modules frontend(Announcement, Archive, Faq, PageContent) 2014-08-05 14:45:52 +08:00
manson ef1dda757a update member index page font size 2014-08-03 20:40:24 +08:00
manson c5b501845c fix some bug in structure page form 2014-08-01 21:05:21 +08:00
manson f3882eee10 update structure form 2014-08-01 20:39:23 +08:00
manson 36648d51a2 fix language order in structure page_part form 2014-08-01 20:11:43 +08:00
manson 766b1482b6 Update personal-plugin frontend 2014-08-01 19:51:41 +08:00
manson 0e6caf4e5a add need_access_right method in OrbitBackendHelper 2014-08-01 12:27:46 +08:00
Harry Bomrah f44e6646f1 fixed some member stuff 2014-07-31 21:50:49 +08:00
rulingcom 1681e6671b update design for authorization module 2014-07-31 20:50:06 +08:00
manson c76b65d149 Add authorization for tag and category 2014-07-31 20:48:23 +08:00
Harry Bomrah 49900e9513 member authorizations done... plus layout thing fixed 2014-07-31 20:42:53 +08:00
Harry Bomrah 879c84fd16 a small fix for module without categories and built in extension 2014-07-31 17:17:40 +08:00
Harry Bomrah 399b519bea authorizations for users done 2014-07-31 16:48:59 +08:00
Harry Bomrah 33edfd779c new authorization.. yet to complete in alpha.. 2014-07-31 16:48:59 +08:00
manson 69db2e2926 Rewrite member frontend, fix I18n.enforce_available_locales, update CKEditor setting 2014-07-31 15:41:28 +08:00
spen 0f4ea70943 remove <p> tags in CKEditor 2014-07-29 15:24:01 +08:00
manson 4de07afb2a update member import,frontend,structure
member frontend order is hard-coded
2014-07-29 11:21:27 +08:00
Harry Bomrah 58bcf69940 fixed layout structure in signup layout 2014-07-28 21:46:36 +08:00
Ray cc54f7f908 selecting interface for edit and add and module page is done. 2014-07-28 20:33:51 +08:00
manson 5182dbdaf9 fix member layout for new orbit-bar 2014-07-28 15:54:14 +08:00
Harry Bomrah 0095e41b46 changed orbit bar for backend ... added preview to layouts for widgets and index ... also fixed alot of bugs.. 2014-07-25 20:11:51 +08:00
manson e0a5798927 fix sit breadcrumb for page_type link 2014-07-25 12:24:58 +08:00
manson 96dd726981 Fix member frontend role status 2014-07-25 10:50:50 +08:00
manson d6085ad13e Added import plugin back to index js 2014-07-24 20:19:30 +08:00
manson d6287177a2 Update member frontend and fix member import missing fields 2014-07-24 20:12:35 +08:00
Harry Bomrah 8676e06c87 mobile view changed with live preview 2014-07-24 14:08:20 +08:00
Harry Bomrah 98efc38566 now page view shows realtime page...and allows you to edit it 2014-07-24 14:00:43 +08:00
manson c37976c62e update site structure for members and member frontend controller 2014-07-24 00:04:10 +08:00
manson 91e6b2385c Fix member import role status issue 2014-07-22 17:19:39 +08:00
manson af6d41bc4d fix structure page form and added missing module files in template 2014-07-22 16:48:46 +08:00
manson a8f2112e39 Add edit_password button and member_profile button for frontend orbit bar 2014-07-22 09:58:41 +08:00
Harry Bomrah 3fae3327b3 implemented the feature of current working page not collapsed .. the pages are not collapsed if you are working under a page in site structure 2014-07-21 22:21:17 +08:00
manson bbb537f7bb update backend index table filter js 2014-07-21 14:11:10 +08:00
manson 55bf9c4343 fix orbit bar edit password and profile link 2014-07-21 11:46:26 +08:00
manson a6cc379e7a Fix zh_cn language switching 2014-07-20 03:05:30 +08:00
manson 562a7a79b8 Fix member side_bar personal_plugin link 2014-07-18 19:49:44 +08:00
manson 4765f3e291 Testing fix for widget registrations 2014-07-18 18:04:21 +08:00
Harry Bomrah 655e7d7d3f added method to model before create 2014-07-18 18:03:18 +08:00
Harry Bomrah 2ed5d10b9d added page number fix for new pages 2014-07-18 17:21:16 +08:00
manson a96fb661c8 Update mobile template and fix page module validation and scrolltop when validate failed 2014-07-18 16:32:17 +08:00
manson 118d70b7f6 Fix import bugs, routing keyword_constraint issue and template update for book and journal plugins 2014-07-18 15:14:02 +08:00
Harry Bomrah b1ed03b01c added validations to page create. and also now can make pages without assigning modules .. frontend will be blank 2014-07-18 14:43:02 +08:00
manson 747f794a18 Update RWD for dashboard and OrbitBar 2014-07-17 18:38:08 +08:00
manson 8ab1a5f753 Fix RWD for dashboard 2014-07-17 17:40:54 +08:00
manson 03baa31648 Fix page edit form category_list tag_list stats_list 2014-07-17 15:16:02 +08:00
manson 3f285d9c1e Category and Tag validation 2014-07-17 11:54:40 +08:00
Saurabh Bhatia df91ad152c added back modal select for authorization 2014-07-17 11:53:37 +08:00
Saurabh Bhatia 62260147b1 fix for nil user in authorization 2014-07-17 11:50:41 +08:00
spen a1ab533b43 Fix orbit_mailer file read and _right_menu login issue 2014-07-17 11:07:45 +08:00
manson ccaede2f1d added validation feedback for memebr form 2014-07-16 19:39:23 +08:00
manson 0dccaacbaf Fix member module form issues 2014-07-16 19:13:54 +08:00
Harry Bomrah 6bb2708b82 now the external links open in new browser window and internal links open in same window. also now internal links are independent of the host 2014-07-16 18:49:38 +08:00
manson ce525719b7 Rescue nil for page_parts 2014-07-16 17:13:42 +08:00
Harry Bomrah 32c6975f76 made frontend kernel more stable .. now should not break in any case 2014-07-16 17:12:23 +08:00
Harry Bomrah 9b42eb4e8b added html_safe 2014-07-16 15:25:02 +08:00
Harry Bomrah ab97083408 added rescue 2014-07-16 15:23:27 +08:00
Harry Bomrah 0cca5ec1b2 added a msg for module frontend problem 2014-07-16 15:21:51 +08:00
manson 2f3e60b0df Added ad_banner backend table sorting 2014-07-16 15:19:53 +08:00
Harry Bomrah 6f3e951ba8 now page will render not give 500 error if controller doesnt send anything back 2014-07-16 15:12:41 +08:00
Harry Bomrah 8c0d4f53b0 added expanding and collapsing feature to the site structure.. collapsed by default 2014-07-16 15:04:52 +08:00
manson f5bf50ef14 Fix session redirect and fix import language field 2014-07-16 11:42:10 +08:00
manson d40a1fae34 Fix member frontend routing 2014-07-16 11:02:10 +08:00
rulingcom 2e1680cbac Update template by Ray 2014-07-16 10:17:33 +08:00
manson 69e09950e1 Removed personal_plugin.html.erb from template 2014-07-16 09:54:20 +08:00
manson 6cccdbc9ab Handle execptions for import and fix plugin templates 2014-07-15 19:10:51 +08:00
Harry Bomrah 2e447476b3 member import with plugins are done. 2014-07-15 18:07:28 +08:00
manson d9bf2c7ddc Add import_journals, conferences 2014-07-15 17:43:22 +08:00
manson 23fdf6dc37 Fix member edit_privilege issue 2014-07-15 10:10:47 +08:00
Harry Bomrah f61efc2472 import methods for plugins honor, patent, research, books, diploma, project, experience 2014-07-14 21:33:46 +08:00
manson 63270e2a79 Added tag in site structure 2014-07-11 21:12:08 +08:00
Harry Bomrah e00ec26409 book import complete with mobile page enable and disable 2014-07-11 21:07:47 +08:00
Saurabh Bhatia e94ee50674 Fix role status issue 2014-07-11 12:17:43 +08:00
Harry Bomrah 9a4ef31352 modified zh_cn render method. removed extra code from page_controller show method 2014-07-10 15:51:00 +08:00
Saurabh Bhatia cbf1114c4f fixes for import, fixes for deletes 2014-07-10 14:50:59 +08:00
Harry Bomrah f9dcd32252 fixed edit page and add page bug after adding new page 2014-07-09 19:45:53 +08:00
Harry Bomrah 1f1c040fe9 fixed reimport bug 2014-07-09 18:40:33 +08:00
Harry Bomrah 97d4a94583 modified gallery import for server timeout 2014-07-09 18:35:55 +08:00
Saurabh Bhatia 44adbf57b2 make users autoapproved once imported, orbit member accessible only to admin 2014-07-09 17:21:37 +08:00
Saurabh Bhatia e3e300b3cd fix for basic info 2014-07-09 16:53:12 +08:00
Saurabh Bhatia c6dd73a98e member import and some fixes in member backend 2014-07-09 11:22:21 +08:00
manson 1492e6e9e8 Add zh_cn, working but it's hard code 2014-07-09 10:05:02 +08:00
747 changed files with 30543 additions and 41568 deletions

3
.gitignore vendored
View File

@ -20,4 +20,7 @@
app/views/frontend app/views/frontend
/public/uploads/* /public/uploads/*
public/assets/* public/assets/*
public/site_feeds/*
public/import_status.yml public/import_status.yml
public/announcement_link_widget_en.json
public/announcement_link_widget_zh_tw.json

View File

@ -1 +1 @@
ruby 2.1.1 ruby 2.1

39
Gemfile
View File

@ -1,16 +1,20 @@
source 'https://rubygems.org' source 'https://rubygems.org'
#social gems
gem "omniauth-google-oauth2", "~> 0.2.1"
#rails gem #rails gem
gem 'rails', '~> 4.1.0' gem 'rails', '~> 4.1.0'
gem 'sanitize'
#assets and templates #assets and templates
gem 'sass-rails', '~> 4.0.2' gem 'sass-rails', '~> 4.0.2'
gem 'uglifier', '>= 1.3.0' gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0' gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails' gem 'jquery-rails'
gem 'jquery-ui-rails', "4.0.5" gem 'jquery-ui-rails', "5.0.0"
gem 'turbolinks' gem 'turbolinks'
gem 'normalize-rails', '~> 3.0.1'
#password #password
gem 'bcrypt-ruby', '~> 3.1.5' gem 'bcrypt-ruby', '~> 3.1.5'
@ -27,13 +31,14 @@ gem 'nokogiri'
gem 'httparty' gem 'httparty'
#database #database
gem 'mongoid', github: "mongoid/mongoid" # gem 'mongoid', github: "mongoid/mongoid"
gem 'mongoid', '~> 4.0.2'
#file uploading and carrierwave #file uploading and carrierwave
gem "mini_magick", github: 'minimagick/minimagick' gem "mini_magick", "3.5.0"
gem 'carrierwave' gem 'carrierwave'
gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid' gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
gem 'zip-zip'
gem 'kaminari' gem 'kaminari'
gem "impressionist" gem "impressionist"
gem "chartkick" gem "chartkick"
@ -41,6 +46,17 @@ gem 'usagewatch_ext'
gem 'ckeditor' gem 'ckeditor'
gem 'unicorn' gem 'unicorn'
gem 'zhconv' gem 'zhconv'
gem 'time_difference'
gem 'execjs'
gem 'therubyracer'
#excel
gem 'axlsx_rails'
gem 'spreadsheet'
gem 'rubyXL'
#form helpers
gem 'dynamic_form'
#built in modules #built in modules
eval(File.read(File.dirname(__FILE__) + '/built_in_extensions.rb')) eval(File.read(File.dirname(__FILE__) + '/built_in_extensions.rb'))
@ -56,7 +72,7 @@ group :development do
gem 'rb-fchange', :require=>false gem 'rb-fchange', :require=>false
gem 'rb-fsevent', :require=>false gem 'rb-fsevent', :require=>false
gem 'rb-inotify', :require=>false gem 'rb-inotify', :require=>false
gem 'debugger', '>= 1.6.6' gem 'byebug'
gem "binding_of_caller" gem "binding_of_caller"
end end
@ -66,3 +82,14 @@ group :test do
gem 'minitest-spec-rails' gem 'minitest-spec-rails'
end end
#ask
gem 'gotcha'
#caching observers
gem 'mongoid-observers'
#desktop
# gem 'angularjs-rails', '~> 1.2.20'
# gem 'angular-ui-bootstrap-rails', '~> 0.11.0'
# gem 'jquery_mousewheel_rails', '~> 3.1.11.3'

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

BIN
app/assets/images/spin.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -41,7 +41,17 @@ $(document).ready(function(){
t = getUrlParam('CKEditor').split("_"), t = getUrlParam('CKEditor').split("_"),
language = t[t.length-1]; language = t[t.length-1];
language = (language == "tw" ? "zh_tw" : language); language = decodeURIComponent(language);
language = (language == "tw" || language == "tw]" ? "zh_tw" : language);
if(language.endsWith("]")){
var re = ("\\[(.*)]"),
matches = language.match(re);
console.log(matches)
if(matches){
language = matches[1];
}
}
}) })
@ -55,7 +65,7 @@ function getUrlParam( paramName ) {
var initAssets = function(){ var initAssets = function(){
$("#asset_sort_list").on(clickEvent,"input[type=checkbox]",function(){ $("#asset_sort_list").on(clickEvent,"input[type=checkbox]",function(){
if($("#asset_sort_list input[type=checkbox]:checked").length == 1){ if($("#asset_sort_list input[type=checkbox]:checked").length == 1){
url = window.location.protocol + "//" + window.location.host + $("#url_" + $("input[type=checkbox]:checked").val()).val(); url = $("#url_" + $("input[type=checkbox]:checked").val()).val();
insertBtn.show(); insertBtn.show();
showPreview($("input[type=checkbox]:checked")) showPreview($("input[type=checkbox]:checked"))
}else{ }else{
@ -69,6 +79,7 @@ var initAssets = function(){
deleteBtn.hide(); deleteBtn.hide();
}) })
insertBtn.bind(clickEvent,function(){ insertBtn.bind(clickEvent,function(){
console.log(language);
var alt_text = $("#"+language+"_desc_"+$("input[type=checkbox]:checked").val()).val(); var alt_text = $("#"+language+"_desc_"+$("input[type=checkbox]:checked").val()).val();
alt_text = (alt_text ? alt_text : "This is an image"); alt_text = (alt_text ? alt_text : "This is an image");
if(url){ if(url){

View File

@ -0,0 +1,210 @@
var StoreManager = function(section){
var storeArea = $("#store-area"),
loadingArea = storeArea.find(".loading-store"),
loadingAreaStatus = loadingArea.find(".loading-status"),
waitForStoreResponseCount = 0,
section = section,
formArea = storeArea.find(".form-area");
var initialize = function(){
loadingArea.find("img").show();
loadingAreaStatus.text("Contacting Ruling Store.");
loadingArea.find("p").eq(1).html("Please wait...");
setTimeout(step1,1000);
}
var step1 = function(){
$.ajax({
"type" : "get",
"dataType" : "json",
"url" : "/admin/store/check_credentials"
}).done(function(status){
if(status.success == true){
loadingAreaStatus.text("Checking permissions.");
setTimeout(step2,1000);
}else if(status.success == false){
setTimeout(loadRegisterForm,1000);
}
}).fail(showError);
}
var step2 = function(){
$.ajax({
"type" : "get",
"dataType" : "json",
"url" : "/admin/store/check_permissions"
}).done(function(data){
if(data.success){
loadingAreaStatus.text("Fetching store data.");
if(section == "templates"){
setTimeout(loadTemplateStore,1000);
}else if(section == "apps"){
setTimeout(loadAppStore,1000);
}
}else if(!data.success){
loadingArea.find("img").hide();
loadingAreaStatus.text(data.message);
if(data.error == "SITE_NOT_CONFIRMED"){
var resentBtn = $("<a href=''>Resend Email</a>");
resentBtn.on("click",function(){
resendEmail();
return false;
})
loadingArea.find("p").eq(1).html(resentBtn);
}else if(data.error == "SITE_PERMISSION_DENIED"){
loadingArea.find("p").eq(1).html("Please contact <a href='http://www.rulingcom.com/'>www.rulingcom.com</a>.");
}else{
loadingArea.find("p").eq(1).html("Please contact <a href='http://www.rulingcom.com/'>www.rulingcom.com</a>.");
}
}
}).fail(showError);
}
var loadTemplateStore = function(){
$.ajax({
"type" : "get",
"dataType" : "html",
"url" : "/admin/store/template_store"
}).done(function(html){
storeArea.html(html);
}).fail(showError);
}
var loadAppStore = function(){
$.ajax({
"type" : "get",
"dataType" : "html",
"url" : "/admin/store/app_store"
}).done(function(html){
storeArea.html(html);
}).fail(showError);
}
var loadTemplateStore = function(){
$.ajax({
"type" : "get",
"dataType" : "html",
"url" : "/admin/store/template_store"
}).done(function(html){
storeArea.html(html);
}).fail(showError);
}
var loadRegisterForm = function(){
loadingAreaStatus.text("Loading registeration form.")
$.ajax({
"type" : "get",
"dataType" : "html",
"url" : "/admin/store/register_form"
}).done(function(html){
loadingArea.hide();
formArea.html(html);
var form = formArea.find("form");
new FormValidator(form);
form.on("submit",function(){
var email = form.find("#inputEmail").val(),
site_title = {};
site_title["en"] = form.find("#input_site_title_en").val();
site_title["zh_tw"] = form.find("#input_site_title_zh_tw").val();
if(email){
loadingAreaStatus.text("Registering with Orbit Store.")
formArea.hide();
loadingArea.show();
$.ajax({
"type" : "post",
"url" : form.attr("action"),
"dataType" : "json",
"data" : {"email" : email, "site_title" : site_title}
}).done(function(data){
if(data.success){
loadingAreaStatus.text("Waiting for Store.");
setTimeout(waitForStoreResponse,500);
}else{
loadingArea.find("img").hide();
loadingAreaStatus.text(data.message);
loadingArea.find("p").eq(1).html("Please contact <a href='http://www.rulingcom.com/'>www.rulingcom.com</a>.");
}
}).fail(showError)
}
return false;
})
})
}
var waitForStoreResponse = function(){
$.ajax({
"type" : "get",
"dataType" : "json",
"url" : "/admin/store/check_credentials"
}).done(function(status){
if(status.success == true){
authorizeAllModules();
}else if(status.success == false){
waitForStoreResponseCount++;
if(waitForStoreResponseCount > 5){
loadingArea.find("img").hide();
loadingAreaStatus.text("Orbit Store couldn't contact your server.");
loadingArea.find("p").eq(1).html("Please try again later or contact <a href='http://www.rulingcom.com/'>www.rulingcom.com</a>.");
}else{
setTimeout(waitForStoreResponse,500);
}
}
}).fail(showError);
}
var authorizeAllModules = function(){
loadingAreaStatus.text("Authorizing default modules.");
$.ajax({
"type" : "post",
"dataType" : "json",
"url" : "/admin/store/authorize_default_modules"
}).done(function(status){
if(status.success == true){
resendEmail();
}else if(status.success == false){
loadingArea.find("img").hide();
loadingAreaStatus.text(data.message);
}
}).fail(showError);
}
var resendEmail = function(){
loadingArea.find("img").show();
loadingAreaStatus.text("Sending verification email.");
loadingArea.find("p").eq(1).html("Please wait...");
$.ajax({
"url" : "/admin/store/send_email",
"dataType" : "json",
"type" : "get"
}).done(function(data){
if(data.success){
loadingArea.find("img").hide();
loadingAreaStatus.text("Email sent. Please confirm and click on link below or refresh the page.");
var checkAgainBtn = $("<a href=''>Check Again</a>");
checkAgainBtn.on("click",function(){
initialize();
return false;
})
loadingArea.find("p").eq(1).html(checkAgainBtn);
}else{
loadingArea.find("img").hide();
loadingAreaStatus.text("Email couldn't be sent. You can try again or contact <a href='http://www.rulingcom.com'>www.rulingcom.com</a>");
loadingArea.find("p").eq(1).html("Please contact <a href='http://www.rulingcom.com/'>www.rulingcom.com</a>.");
}
}).fail(showError);
}
var showError = function(){
loadingArea.find("img").hide();
loadingAreaStatus.text("There was some unknown error.");
loadingArea.find("p").eq(1).html("Please try again later or contact <a href='http://www.rulingcom.com/'>www.rulingcom.com</a>.");
}
initialize();
}
// step 1 -> check connection to store server
// step 2 -> check for site confirmation and access permission

View File

@ -10,7 +10,3 @@
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives. // about supported directives.
// //
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .

View File

@ -2,7 +2,7 @@
//= require jquery_ujs //= require jquery_ujs
//= require basic/bootstrap //= require basic/bootstrap
//= require jquery.ui.tooltip //= require jquery-ui/tooltip
//= require basic/iscroll //= require basic/iscroll
//= require basic/orbit_js_1.0.1.js //= require basic/orbit_js_1.0.1.js
//= require basic/jquery.nanoscroller.js //= require basic/jquery.nanoscroller.js

View File

@ -291,7 +291,8 @@ if($.support.touch) {
$el.find('a').removeAttr('href'); $el.find('a').removeAttr('href');
}; };
$el.on(mouseenterEvent, function(e) { $el.on(mouseenterEvent, function(e) {
$block.siblings().removeClass('show').eq($(this).index()).addClass('show'); $sidebar.addClass('on')
$block.siblings().removeClass('show').end().eq($(this).index()).addClass('show');
$arrow.stop(true, false).animate({ $arrow.stop(true, false).animate({
top: ($(this).position().top+$(this).height()/2)-$arrowHeightFormat+$('.scroller').position().top, top: ($(this).position().top+$(this).height()/2)-$arrowHeightFormat+$('.scroller').position().top,
},{ },{
@ -346,6 +347,7 @@ if($.support.touch) {
$el.eq($blockIndex).hasClass('active') ? '':$el.eq($blockIndex).children('span').addClass('hover'); $el.eq($blockIndex).hasClass('active') ? '':$el.eq($blockIndex).children('span').addClass('hover');
}, },
mouseleave: function() { mouseleave: function() {
$sidebar.removeClass('on');
$block.removeClass('show'); $block.removeClass('show');
if(!$sidebarState || !$el.hasClass('active')) { if(!$sidebarState || !$el.hasClass('active')) {
$blockList.css({'width': 0}); $blockList.css({'width': 0});

View File

@ -5,10 +5,14 @@
CKEDITOR.editorConfig = function( config ) { CKEDITOR.editorConfig = function( config ) {
config.uiColor = '#e6e6e6'; config.uiColor = '#e6e6e6';
config.language = 'zh'; config.defaultLanguage = "en";
config.language = '<%= (I18n.locale.to_s == "zh_tw" || I18n.locale.to_s == "zh_cn" ? "zh" : I18n.locale.to_s) %>';
config.height = 400; config.height = 400;
config.resize_minHeight = 400; config.resize_minHeight = 400;
config.toolbarCanCollapse = true; config.toolbarCanCollapse = true;
config.allowedContent = true;
config.pasteFromWordRemoveFontStyles=false;
config.pasteFromWordRemoveStyles=false;
config.plugins = 'dialogui,dialog,about,a11yhelp,dialogadvtab,basicstyles,blockquote,clipboard,button,panelbutton,panel,floatpanel,colorbutton,colordialog,templates,menu,contextmenu,resize,toolbar,elementspath,enterkey,entities,popup,filebrowser,find,image,fakeobjects,floatingspace,listblock,richcombo,font,format,horizontalrule,htmlwriter,iframe,wysiwygarea,indent,indentblock,indentlist,justify,menubutton,link,list,liststyle,magicline,maximize,newpage,pastetext,pastefromword,removeformat,selectall,showblocks,showborders,sourcearea,specialchar,scayt,stylescombo,tab,table,tabletools,undo,wsc,youtube,codemirror'; config.plugins = 'dialogui,dialog,about,a11yhelp,dialogadvtab,basicstyles,blockquote,clipboard,button,panelbutton,panel,floatpanel,colorbutton,colordialog,templates,menu,contextmenu,resize,toolbar,elementspath,enterkey,entities,popup,filebrowser,find,image,fakeobjects,floatingspace,listblock,richcombo,font,format,horizontalrule,htmlwriter,iframe,wysiwygarea,indent,indentblock,indentlist,justify,menubutton,link,list,liststyle,magicline,maximize,newpage,pastetext,pastefromword,removeformat,selectall,showblocks,showborders,sourcearea,specialchar,scayt,stylescombo,tab,table,tabletools,undo,wsc,youtube,codemirror';
@ -35,6 +39,9 @@ CKEDITOR.editorConfig = function( config ) {
//Font Config //Font Config
config.font_names = 'Arial;Comic Sans MS;Courier New;Georgia;Helvetica;Lucida Sans Unicode;Tahoma;Times New Roman;Trebuchet MS;Verdana;微軟正黑體'; config.font_names = 'Arial;Comic Sans MS;Courier New;Georgia;Helvetica;Lucida Sans Unicode;Tahoma;Times New Roman;Trebuchet MS;Verdana;微軟正黑體';
config.enterMode = CKEDITOR.ENTER_BR;
config.shiftEnterMode = CKEDITOR.ENTER_BR;
}; };
CKEDITOR.on('instanceReady',function(){ CKEDITOR.on('instanceReady',function(){

View File

@ -1,50 +1,5 @@
(function(){ (function(){
var getUrlVars = function(){
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++){
hash = hashes[i].split('=');
vars.push(decodeURIComponent(hash[0]));
vars[decodeURIComponent(hash[0])] = decodeURIComponent(hash[1]);
}
if(vars[0] == window.location.href){
vars =[];
}
return vars;
}
var page_params = getUrlVars();
$(document).ready(function(){ $(document).ready(function(){
$("head").append("<link href='/assets/pp-add-edit.css?body=1' media='screen' rel='stylesheet' /> "); $("head").append("<link href='/assets/pp-add-edit.css?body=1' media='screen' rel='stylesheet' /> ");
var dataObject = (page_params['mobile_view'] ? {"page_id" : page_params["id"],"mobile_view" : 1} : {"page_id" : page_params["id"]})
$.ajax({
url : "/page_parts/info",
dataType : "json",
type : "get",
data : dataObject
}).done(function(data){
$.each(data.parts,function(i,part){
var page_part = $("*[" + part.name + "]");
$.each(part.subparts,function(x,subpart){
var newsub = (subpart.kind == "module_widget" ? $("<div data-partid='" + part.id + "' data-ps='" + subpart.id + "'>" + subpart.module + "/" + subpart.widget + "</div>") : $("<div data-partid='" + part.id + "' data-ps='" + subpart.id + "'>Text</div>"));
page_part.prepend(newsub);
newsub.click(function(){
window.location.href = "/page_parts/edit_sub_part?page_id=" + page_params["id"] + "&part_id=" + $(this).data("partid") + "&sub_part_id=" + $(this).data("ps")+(page_params["mobile_view"] ? "&mobile_view=1": "");
})
})
})
})
$("*[data-pp]").each(function(){
var add_btn = $("<p class='add-ps'></p>"),
part = $(this);
add_btn.click(function(){
if(part.find("*[data-ps]").length){
window.location.href = "/page_parts/" + part.data("pp") + "/edit?page_id=" + page_params["id"]+(page_params["mobile_view"] ? "&mobile_view=1": "");
}else{
window.location.href = "/page_parts/new?part=" + part.data("pp") + "&page_id=" + page_params["id"]+(page_params["mobile_view"] ? "&mobile_view=1": "");
}
})
part.append(add_btn);
})
}) })
})(); })();

View File

@ -0,0 +1,16 @@
(function($) {
$("document").ready(function(){
// Get link data-attribute and make the banner clickable
$('.w-ad-banner__slide')
.not('[data-link=""]')
.not(".youtube")
.addClass('cursor')
.on("click",function(){
if( $(this).data('target') === '_blank' ) {
window.open($(this).data("link"), "_blank");
} else {
window.location.href = ($(this).data("link"));
}
})
})
}(jQuery));

View File

@ -0,0 +1,139 @@
(function() {
"use strict";
// Commonly use variables
var doc = document;
var group = {
// Detect and change the top position of the cycle navs
cycleFix: function() {
if (doc.querySelectorAll(".group-show-post-banner-image").length >= 1) {
var imgs = doc.querySelectorAll(".group-show-post-banner-image"),
cycleNav = doc.querySelectorAll(".cycle-nav"),
len = cycleNav.length,
i = -1;
// Hide the navs when there's noly one slide
if (imgs.length <= 1) {
for (i = 0; i < len; i++) {
cycleNav[i].classList.add("hide");
}
}
} else if (doc.querySelectorAll(".group-show-post-banner-image").length === 0 && doc.querySelector(".group-show-post-image-wrap")) {
doc.querySelector(".group-show-post-image-wrap").classList.add("hide");
}
},
// Create scroll effect (with css)
scrollEffect: function(el) {
var wrap = doc.querySelector(el),
scrollClass = "scroll";
// Use pageYOffset to get the Y positoin and add scroll on it, the animation
// is done by css transition
if (el) {
window.addEventListener("scroll", function() {
if (window.pageYOffset > 0) {
wrap.classList.add(scrollClass);
} else {
wrap.classList.remove(scrollClass);
}
}, false);
}
},
// Equal height for card
equalHeight: function(el) {
var bigbrother = -1,
$el = $(el);
$el.each(function() {
bigbrother = bigbrother > $(this).height() ? bigbrother : $(this).height();
});
$el.each(function() {
$(this).height(bigbrother);
});
},
// We want to place a dropdown in group-post-item, but link cannot be nested, hance this fix
makePostClick: function() {
var postLink = doc.querySelectorAll('.group-post-link');
if (postLink) {
Array.prototype.forEach.call(postLink, function(item) {
item.parentNode.classList.add('clickable');
item.parentNode.addEventListener('click', function(e) {
window.location.href = item.href;
});
});
}
},
// Bootstrap dropdown is too much of a hassle, using this instead
makeDropdown: function(container, toggle, dropdown, kls) {
var $container = $(container),
$toggle = $container.find(toggle),
$dropdown = $container.find(dropdown),
klass = 'open';
$container.on('click', '.toggle', function(e) {
if ($(this).hasClass(klass)) {
$(toggle).removeClass(klass);
$(dropdown).removeClass(klass);
} else {
$(toggle).removeClass(klass);
$(dropdown).removeClass(klass);
$(this)
.addClass(klass)
.next(dropdown)
.addClass(klass)
}
return false;
});
$(document.body).on('click', function() {
$(toggle).removeClass(klass)
$(dropdown).removeClass(klass);
});
},
// Third-party plugin settings
plugins: function() {
// WOWjs
if (typeof window.WOW !== 'undefined') {
new WOW().init();
}
}
}
// When DOM is completely loaded, execute these functions
document.addEventListener("DOMContentLoaded", function(event) {
if (doc.querySelector('.group-post')) {
group.scrollEffect('.group-post');
group.makeDropdown('.group-post', '.group-post-dropdown-toggle', '.group-post-dropdown');
}
if (doc.querySelector('.group-card')) {
group.makeDropdown('.group-public', '.group-card-dropdown-toggle', '.group-card-dropdown');
}
if (doc.querySelector('.group-index')) {
group.makeDropdown('.group-index', '.group-card-dropdown-toggle', '.group-card-dropdown');
}
if (doc.querySelector('.group-show-post')) {
group.makeDropdown('.group-show-post', '.group-show-post-dropdown-toggle', '.group-show-post-dropdown');
}
if (doc.querySelector('.group-member')) {
group.scrollEffect('.group-member');
}
group.cycleFix();
group.equalHeight('.group-card-inner');
group.equalHeight('.group-admin-edit-image-item');
group.plugins();
});
})();

View File

@ -0,0 +1,388 @@
/*
* The MIT License
* Copyright (c) 2012 Matias Meno <m@tias.me>
*/
@-webkit-keyframes passing-through {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px); }
30%, 70% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px); }
100% {
opacity: 0;
-webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px);
-ms-transform: translateY(-40px);
-o-transform: translateY(-40px);
transform: translateY(-40px); } }
@-moz-keyframes passing-through {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px); }
30%, 70% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px); }
100% {
opacity: 0;
-webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px);
-ms-transform: translateY(-40px);
-o-transform: translateY(-40px);
transform: translateY(-40px); } }
@keyframes passing-through {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px); }
30%, 70% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px); }
100% {
opacity: 0;
-webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px);
-ms-transform: translateY(-40px);
-o-transform: translateY(-40px);
transform: translateY(-40px); } }
@-webkit-keyframes slide-in {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px); }
30% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px); } }
@-moz-keyframes slide-in {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px); }
30% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px); } }
@keyframes slide-in {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px); }
30% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px); } }
@-webkit-keyframes pulse {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); }
10% {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1); }
20% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); } }
@-moz-keyframes pulse {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); }
10% {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1); }
20% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); } }
@keyframes pulse {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); }
10% {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1); }
20% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); } }
.dropzone, .dropzone * {
box-sizing: border-box; }
.dropzone {
min-height: 150px;
border: 2px solid rgba(0, 0, 0, 0.3);
background: white;
padding: 20px 20px; }
.dropzone.dz-clickable {
cursor: pointer; }
.dropzone.dz-clickable * {
cursor: default; }
.dropzone.dz-clickable .dz-message, .dropzone.dz-clickable .dz-message * {
cursor: pointer; }
.dropzone.dz-started .dz-message {
display: none; }
.dropzone.dz-drag-hover {
border-style: solid; }
.dropzone.dz-drag-hover .dz-message {
opacity: 0.5; }
.dropzone .dz-message {
text-align: center;
margin: 2em 0; }
.dropzone .dz-preview {
position: relative;
display: inline-block;
vertical-align: top;
margin: 16px;
min-height: 100px; }
.dropzone .dz-preview:hover {
z-index: 1000; }
.dropzone .dz-preview:hover .dz-details {
opacity: 1; }
.dropzone .dz-preview.dz-file-preview .dz-image {
border-radius: 20px;
background: #999;
background: linear-gradient(to bottom, #eee, #ddd); }
.dropzone .dz-preview.dz-file-preview .dz-details {
opacity: 1; }
.dropzone .dz-preview.dz-image-preview {
background: white; }
.dropzone .dz-preview.dz-image-preview .dz-details {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-ms-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear; }
.dropzone .dz-preview .dz-remove {
font-size: 14px;
text-align: center;
display: block;
cursor: pointer;
border: none; }
.dropzone .dz-preview .dz-remove:hover {
text-decoration: underline; }
.dropzone .dz-preview:hover .dz-details {
opacity: 1; }
.dropzone .dz-preview .dz-details {
z-index: 20;
position: absolute;
top: 0;
left: 0;
opacity: 0;
font-size: 13px;
min-width: 100%;
max-width: 100%;
padding: 2em 1em;
text-align: center;
color: rgba(0, 0, 0, 0.9);
line-height: 150%; }
.dropzone .dz-preview .dz-details .dz-size {
margin-bottom: 1em;
font-size: 16px; }
.dropzone .dz-preview .dz-details .dz-filename {
white-space: nowrap; }
.dropzone .dz-preview .dz-details .dz-filename:hover span {
border: 1px solid rgba(200, 200, 200, 0.8);
background-color: rgba(255, 255, 255, 0.8); }
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) {
overflow: hidden;
text-overflow: ellipsis; }
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span {
border: 1px solid transparent; }
.dropzone .dz-preview .dz-details .dz-filename span, .dropzone .dz-preview .dz-details .dz-size span {
background-color: rgba(255, 255, 255, 0.4);
padding: 0 0.4em;
border-radius: 3px; }
.dropzone .dz-preview:hover .dz-image img {
-webkit-transform: scale(1.05, 1.05);
-moz-transform: scale(1.05, 1.05);
-ms-transform: scale(1.05, 1.05);
-o-transform: scale(1.05, 1.05);
transform: scale(1.05, 1.05);
-webkit-filter: blur(8px);
filter: blur(8px); }
.dropzone .dz-preview .dz-image {
border-radius: 20px;
overflow: hidden;
width: 120px;
height: 120px;
position: relative;
display: block;
z-index: 10; }
.dropzone .dz-preview .dz-image img {
display: block; }
.dropzone .dz-preview.dz-success .dz-success-mark {
-webkit-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-moz-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-ms-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-o-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1); }
.dropzone .dz-preview.dz-error .dz-error-mark {
opacity: 1;
-webkit-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-moz-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-ms-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-o-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1); }
.dropzone .dz-preview .dz-success-mark, .dropzone .dz-preview .dz-error-mark {
pointer-events: none;
opacity: 0;
z-index: 500;
position: absolute;
display: block;
top: 50%;
left: 50%;
margin-left: -27px;
margin-top: -27px; }
.dropzone .dz-preview .dz-success-mark svg, .dropzone .dz-preview .dz-error-mark svg {
display: block;
width: 54px;
height: 54px; }
.dropzone .dz-preview.dz-processing .dz-progress {
opacity: 1;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear; }
.dropzone .dz-preview.dz-complete .dz-progress {
opacity: 0;
-webkit-transition: opacity 0.4s ease-in;
-moz-transition: opacity 0.4s ease-in;
-ms-transition: opacity 0.4s ease-in;
-o-transition: opacity 0.4s ease-in;
transition: opacity 0.4s ease-in; }
.dropzone .dz-preview:not(.dz-processing) .dz-progress {
-webkit-animation: pulse 6s ease infinite;
-moz-animation: pulse 6s ease infinite;
-ms-animation: pulse 6s ease infinite;
-o-animation: pulse 6s ease infinite;
animation: pulse 6s ease infinite; }
.dropzone .dz-preview .dz-progress {
opacity: 1;
z-index: 1000;
pointer-events: none;
position: absolute;
height: 16px;
left: 50%;
top: 50%;
margin-top: -8px;
width: 80px;
margin-left: -40px;
background: rgba(255, 255, 255, 0.9);
-webkit-transform: scale(1);
border-radius: 8px;
overflow: hidden; }
.dropzone .dz-preview .dz-progress .dz-upload {
background: #333;
background: linear-gradient(to bottom, #666, #444);
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 0;
-webkit-transition: width 300ms ease-in-out;
-moz-transition: width 300ms ease-in-out;
-ms-transition: width 300ms ease-in-out;
-o-transition: width 300ms ease-in-out;
transition: width 300ms ease-in-out; }
.dropzone .dz-preview.dz-error .dz-error-message {
display: block; }
.dropzone .dz-preview.dz-error:hover .dz-error-message {
opacity: 1;
pointer-events: auto; }
.dropzone .dz-preview .dz-error-message {
pointer-events: none;
z-index: 1000;
position: absolute;
display: block;
display: none;
opacity: 0;
-webkit-transition: opacity 0.3s ease;
-moz-transition: opacity 0.3s ease;
-ms-transition: opacity 0.3s ease;
-o-transition: opacity 0.3s ease;
transition: opacity 0.3s ease;
border-radius: 8px;
font-size: 13px;
top: 130px;
left: -10px;
width: 140px;
background: #be2626;
background: linear-gradient(to bottom, #be2626, #a92222);
padding: 0.5em 1.2em;
color: white; }
.dropzone .dz-preview .dz-error-message:after {
content: '';
position: absolute;
top: -6px;
left: 64px;
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #be2626; }

File diff suppressed because it is too large Load Diff

View File

@ -4,19 +4,20 @@ var Items = function(){
i.bindHandlers(); i.bindHandlers();
i.itemQuantity(); i.itemQuantity();
i.bindEditAddPageHandlers(); i.bindEditAddPageHandlers();
$(".sortable").delegate(".brand, .delete", clickEvent, function(e){
if($(this).hasClass('delete')) {
$target = $(this);
$('#dialog').modal('show');
} else {
if($(this).closest('li').children('ol').length > 0){
$(this).closest('li').toggleClass('collapsed');
}
}
e.preventDefault();
});
} }
this.bindHandlers = function(){ this.bindHandlers = function(){
var $openSlide = $('.open-slide'),
$pageslideW = $(window).width() > 1440 ? 1024 : 954;
$(window).resize(function() {
$(this).width() > 1440 ? $pageslideW = 1024 : $pageslideW = 954;
});
$iFrame = $openSlide.filter('.view-page.open-slide');
$iFrame.pageslide({
W: $pageslideW,
iframe: true
});
$('.sortable').nestedSortable({ $('.sortable').nestedSortable({
handle: '.brand', handle: '.brand',
items: 'li', items: 'li',
@ -29,18 +30,25 @@ var Items = function(){
update: function(event, ui) { update: function(event, ui) {
var parent = (ui.item.parent().closest('li').length ? ui.item.parent().closest('li') : ui.item.parent().closest('ol')), var parent = (ui.item.parent().closest('li').length ? ui.item.parent().closest('li') : ui.item.parent().closest('ol')),
children = (parent.hasClass("root") ? parent.find(">li") : parent.find(">ol li")), children = (parent.hasClass("root") ? parent.find(">li") : parent.find(">ol li")),
children_ids = []; parents_parent = (parent.parent().closest('li').length ? parent.parent().closest('li') : parent.parent().closest('ol')),
parents_children = (parents_parent.hasClass("root") ? parents_parent.find(">li") : parents_parent.find(">ol li"))
children_ids = [],
parent_children_ids = [];
children.each(function(){ children.each(function(){
children_ids.push($(this).attr("id")); children_ids.push($(this).attr("id"));
}) })
parents_children.each(function(){
parent_children_ids.push($(this).attr("id"));
})
$.ajax({ $.ajax({
url : "<%= Rails.application.routes.url_helpers.pages_update_item_position_path %>", url : "<%= Rails.application.routes.url_helpers.pages_update_item_position_path %>",
data : {"parent_id" : parent.attr("id"), "id" : ui.item.attr("id"),"children_ids" : children_ids}, data : {"parent_id" : parent.attr("id"), "id" : ui.item.attr("id"), "children_ids" : children_ids, "parents_parent_id" : parents_parent.attr("id"), "parent_children_ids" : parent_children_ids},
dataType : "json", dataType : "json",
type : "post" type : "post"
}) })
} }
}); });
} }
this.itemQuantity = function(){ this.itemQuantity = function(){
@ -63,10 +71,12 @@ var Items = function(){
} }
this.reBindHandlers = function(){ this.reBindHandlers = function(){
console.log("binded")
$.pageslide.close(); $.pageslide.close();
window.openSlide();
i.itemQuantity(); i.itemQuantity();
i.bindHandlers(); i.bindHandlers();
window.openSlide(); i.bindEditAddPageHandlers();
} }
this.bindEditAddPageHandlers = function(){ this.bindEditAddPageHandlers = function(){
@ -80,25 +90,48 @@ var Items = function(){
} }
}) })
sidePanel.on("click","#tags_list input[type=checkbox]",function(){
if($(this).is(":checked") && $(this).hasClass("checkbox-all")){
$(".view-page .content #tags_list input[type=checkbox]").not($(this)).removeAttr("checked");
}else{
$(".view-page .content #tags_list input[type=checkbox].checkbox-all").removeAttr("checked");
}
})
sidePanel.on("click","#role_list input[type=checkbox]",function(){
if($(this).is(":checked") && $(this).hasClass("checkbox-all")){
$(".view-page .content #role_list input[type=checkbox]").not($(this)).removeAttr("checked");
}else{
$(".view-page .content #role_list input[type=checkbox].checkbox-all").removeAttr("checked");
$("#status-list-"+$(this).val()+" input[type=checkbox]").removeAttr("checked");
}
})
sidePanel.on("click",".status-checkbox",function(){
if($(this).is(":checked")){
$(this).parent().parent().parent().parent().find(".role-checkbox").removeAttr("checked");
}
})
sidePanel.on("click","#enable-menu .main-enable-parent",function(e){ sidePanel.on("click","#enable-menu .main-enable-parent",function(e){
if(!$(this).is(":checked")){ if(!$(this).is(":checked")){
var parent = $(this).parent().parent(); var parent = $(this).parent().parent();
parent.find(".main-enable-child,.main-enable-child-child").removeAttr("checked"); $(".main-enable-child[value="+ $(this).val() +"]").removeAttr("checked");
$(".main-enable-child-child[value="+ $(this).val() +"]").removeAttr("checked");
} }
}) })
sidePanel.on("click","#enable-menu .main-enable-child",function(e){ sidePanel.on("click","#enable-menu .main-enable-child",function(e){
if(!$("input[for=checkbox_for_"+ $(this).val() +"]").is(":checked")){ if(!$(".main-enable-parent[value="+ $(this).val() +"]").is(":checked")){
$(this).removeAttr("checked"); $(this).removeAttr("checked");
} }
if(!$(this).is(":checked")){ if(!$(this).is(":checked")){
$(this).parent().parent().parent().find(".main-enable-child-child").removeAttr("checked"); $(".main-enable-child-child[value="+ $(this).val() +"]").removeAttr("checked");
} }
}) })
sidePanel.on("click","#enable-menu .main-enable-child-child",function(e){ sidePanel.on("click","#enable-menu .main-enable-child-child",function(e){
if(!$("input[for=checkbox_for_child_"+ $(this).val() +"]").is(":checked")){ if(!$(".main-enable-child[value="+ $(this).val() +"]").is(":checked")){
$(this).removeAttr("checked"); $(this).removeAttr("checked");
} }
}) })
@ -106,10 +139,14 @@ var Items = function(){
sidePanel.on("change","select.module_select", function(){ sidePanel.on("change","select.module_select", function(){
var this_value = $(this).val(), var this_value = $(this).val(),
categories_list = $("#categories_list") categories_list = $("#categories_list")
tags_list = $("#tags_list"),
role_list = $("#role_list"),
layouts_list = $("#layouts_list"), layouts_list = $("#layouts_list"),
data_count_area = $("#data_count_area"); data_count_area = $("#data_count_area");
categories_list.html(""); categories_list.html("");
tags_list.html("");
role_list.html("");
if(this_value){ if(this_value){
$.ajax({ $.ajax({
url : "<%= Rails.application.routes.url_helpers.pages_get_categories_path %>", url : "<%= Rails.application.routes.url_helpers.pages_get_categories_path %>",
@ -117,10 +154,16 @@ var Items = function(){
type : "get", type : "get",
dataType : "json" dataType : "json"
}).done(function(data){ }).done(function(data){
if(this_value=="member"){
$("#member_sort_setting").html("<label class='control-label'><%= I18n.t(:sort) %>:</label><div class='controls'><input checked='checked' id='page_member_sort_position_false' name='page[member_sort_position]' type='radio' value='false'> <%= I18n.t(:sort_by_role_fields) %><br><input id='page_member_sort_position_true' name='page[member_sort_position]' type='radio' value='true'> <%= I18n.t(:sort_manually) %><a href='/admin/members/edit_order_list' target='_blank'> <%= I18n.t(:sort_edit_order) %> </a></div>");
}else{
$("#member_sort_setting").html("");
}
var controlDiv = $("<div class='controls'></div>"); var controlDiv = $("<div class='controls'></div>");
if(data.categories.length){ if(data.categories.length){
categories_list.parent().find("label.control-label").text("Category List :"); categories_list.parent().find("label.control-label").text("<%= I18n.t(:category) %> :");
var checkbox = $("<label class='checkbox'><input type='checkbox' value='all' name='page[categories][]' class='checkbox-all' /> All </label>"); var checkbox = $("<label class='checkbox'><input type='checkbox' value='all' name='page[categories][]' class='checkbox-all' /> <%= I18n.t(:all) %> </label>");
controlDiv.append(checkbox); controlDiv.append(checkbox);
$.each(data.categories,function(i,category){ $.each(data.categories,function(i,category){
var checkbox = $("<label class='checkbox'><input type='checkbox' value='"+ category.id +"' name='page[categories][]' /> " + category.title + " </label>"); var checkbox = $("<label class='checkbox'><input type='checkbox' value='"+ category.id +"' name='page[categories][]' /> " + category.title + " </label>");
@ -130,15 +173,69 @@ var Items = function(){
}else{ }else{
categories_list.parent().find("label.control-label").text(""); categories_list.parent().find("label.control-label").text("");
} }
var controlDiv = $("<div class='controls'></div>");
if(data.tags.length){
tags_list.parent().find("label.control-label").text("<%= I18n.t(:tags) %> :");
var checkbox = $("<label class='checkbox'><input type='checkbox' value='all' name='page[tags][]' class='checkbox-all' /> <%= I18n.t(:all) %> </label>");
controlDiv.append(checkbox);
$.each(data.tags,function(i,tag){
var checkbox = $("<label class='checkbox'><input type='checkbox' value='"+ tag.id +"' name='page[tags][]' /> " + tag.name + " </label>");
controlDiv.append(checkbox);
})
tags_list.html(controlDiv);
}else{
tags_list.parent().find("label.control-label").text("");
}
var controlDiv = $("<div class='controls'></div>");
if(data.roles.length){
role_list.parent().find("label.control-label").text("<%= I18n.t(:role) %> :");
var checkbox = $("<label class='checkbox'><input type='checkbox' value='all' name='page[categories][]' class='checkbox-all' /> <%= I18n.t(:all) %> </label>");
controlDiv.append(checkbox);
$.each(data.roles,function(i,role){
var status_list = '<ul id="status-list-'+role.id+'">';
$.each(role.status,function(i,status){
status_list+='<li><label class="checkbox"><input type="checkbox" value="'+status['id']+'" class="status-checkbox" name="page[role_status][]" >'+status['title']+'</label></li>';
});
status_list += '</ul>';
var checkbox = $("<label class='checkbox'><input type='checkbox' class='role-checkbox' value='"+ role.id +"' name='page[categories][]' /> " + role.title + status_list + " </label>");
controlDiv.append(checkbox);
})
role_list.html(controlDiv);
}else{
role_list.parent().find("label.control-label").text("");
}
if(data.layouts.length){ if(data.layouts.length){
layouts_list.parent().find("label.control-label").text("Layout type:"); layouts_list.parent().find("label.control-label").text("Layout type:");
var controlDiv = $("<div class='controls'></div>"), var controlDiv = $("<div class='controls'></div>"),
select = $("<select name='page[layout]'></select>"); select = $("<select name='page[layout]' class='select2' id='page_layout'></select>"),
do_select = false;
$.each(data.layouts,function(i,layout){ $.each(data.layouts,function(i,layout){
if(typeof layout.length == "number"){
select.append("<option value='" + layout + "'>" + layout + "</option>"); select.append("<option value='" + layout + "'>" + layout + "</option>");
}else if(typeof layout.length == "undefined"){
do_select = true;
var name = (layout.name[data.locale] ? layout.name[data.locale] : layout.name);
select.append("<option value='" + layout.filename + "' data-image='" + layout.thumbnail + "'>" + name + "</option>");
}
}) })
controlDiv.html(select); controlDiv.html(select);
layouts_list.html(controlDiv); layouts_list.html(controlDiv);
if(do_select){
select.select2({
formatResult: function(el){
var $element = $(el.element),
image = $element.data("image");
return "<img class='thumbnail' src='" + image + "'/><span class='thumbnail-text'>" + el.text + "</span>";
},
minimumResultsForSearch: -1,
width : 250
});
}
}else{ }else{
layouts_list.parent().find("label.control-label").text(""); layouts_list.parent().find("label.control-label").text("");
layouts_list.empty(); layouts_list.empty();
@ -178,3 +275,28 @@ $(function(){
$("#pageslide_iframe").css("box-shadow","0px 0px 40px #333"); $("#pageslide_iframe").css("box-shadow","0px 0px 40px #333");
}); });
}); });
function customOpenSlide() {
var $openSlide = $('.open-slide'),
$pageslideW;
$(window).width() > 1440 ? $pageslideW = 1024 : $pageslideW = 954;
$(window).resize(function() {
$(this).width() > 1440 ? $pageslideW = 1024 : $pageslideW = 954;
});
$noiFrame = $openSlide.not('.view-page');
$iFrame = $openSlide.filter('.view-page.open-slide');
$noiFrame.pageslide({
W: 314,
openFn: function(pageslide, element) {},
closeFn: function(pageslide, element) {},
loadComplete: function(pageslide, element) {}
});
$iFrame.pageslide({
W: $pageslideW,
iframe: true,
openFn: function(pageslide, element) {},
closeFn: function(pageslide, element) {},
loadComplete: function(pageslide, element) {}
});
}

View File

@ -223,6 +223,7 @@ $(function() {
}); });
$('#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')) {
var role_staus = [];
if($(this).hasClass('disable')) { if($(this).hasClass('disable')) {
$(this).find('.toggle-check') $(this).find('.toggle-check')
.attr('value', 'false') .attr('value', 'false')
@ -236,7 +237,10 @@ $(function() {
.closest('.attributes') .closest('.attributes')
.addClass('disabled') .addClass('disabled')
.children('.attributes-body') .children('.attributes-body')
.fadeOut(300); .fadeOut(300)
.find('.check')
.attr("checked",false)
.attr("value",role_staus);
} }
$(this).toggleClass('disable'); $(this).toggleClass('disable');
}; };

View File

@ -32,7 +32,6 @@
// Are we loading an element from the page or a URL? // Are we loading an element from the page or a URL?
if ( settings.href.indexOf("#") === 0 ) { if ( settings.href.indexOf("#") === 0 ) {
// Load a page element // Load a page element
window.console.log("in HTML");
var _contentHtml = $(settings.href).html(); var _contentHtml = $(settings.href).html();
var dtd = $.Deferred(); var dtd = $.Deferred();
function appendHtml(dtd) { function appendHtml(dtd) {
@ -53,7 +52,6 @@
} else { } else {
// Load a URL. Into an iframe? // Load a URL. Into an iframe?
if(settings.iframe) { if(settings.iframe) {
window.console.log("iFrame");
var iframe = $('<iframe id="pageslide_iframe" />').attr({ var iframe = $('<iframe id="pageslide_iframe" />').attr({
src: settings.href, src: settings.href,
frameborder: 0, frameborder: 0,
@ -66,7 +64,6 @@
$pageslide.find('.content').css('overflow', 'hidden').html(iframe).show(); $pageslide.find('.content').css('overflow', 'hidden').html(iframe).show();
if(settings.loadComplete)settings.loadComplete.call(this, $pageslide, $element); if(settings.loadComplete)settings.loadComplete.call(this, $pageslide, $element);
} else { } else {
window.console.log("Load");
$pageslide.find('.content').load(settings.href, function(response, status, xhr){ $pageslide.find('.content').load(settings.href, function(response, status, xhr){
if(status == 'success') { if(status == 'success') {
$pageslide.show(); $pageslide.show();
@ -95,9 +92,9 @@
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;
_sliding = true;
if($pageslide.is(':visible')) return;
_sliding = true;
switch(settings.direction) { switch(settings.direction) {
case 'left': case 'left':
$pageslide.css({left: 'auto', right: '-' + slideWidth + 'px'}); $pageslide.css({left: 'auto', right: '-' + slideWidth + 'px'});
@ -132,6 +129,7 @@
// On click // On click
$elements.click( function(e) { $elements.click( function(e) {
var $self = $(this), var $self = $(this),
settings = $.extend({href: $self.attr('href'), pageTitle: $self.data('title')}, options); settings = $.extend({href: $self.attr('href'), pageTitle: $self.data('title')}, options);
@ -320,7 +318,7 @@
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' ) && !$("#modify_fields_to_show").is(":visible")) {
$.pageslide.close(); $.pageslide.close();
} }
}); });

View File

@ -1,21 +1,128 @@
$(document).ready(function() { $(document).ready(function() {
var authorization_type = "managers";
$("ul#authorization-types a").on("click",function(){
authorization_type = $(this).data("for");
switch(authorization_type){
case "managers":
$("ul#card-list-submanagers li.check-item").removeClass("active");
$("ul#card-list-submanagers li.check-item input[type=checkbox]").removeAttr("checked");
break;
case "sub_managers":
$("ul#card-list-managers li.check-item").removeClass("active");
$("ul#card-list-managers li.check-item input[type=checkbox]").removeAttr("checked");
break;
}
hide_or_show_button();
})
$(document).on("change",".selected_user input[type=checkbox], .selected_role input[type=checkbox]",function(){
hide_or_show_button();
})
$("#select_all").on("click",function(){
switch(authorization_type){
case "managers":
$("ul#card-list-managers li.check-item").addClass("active");
$("ul#card-list-managers li.check-item input[type=checkbox]").prop("checked","checked");
break;
case "sub_managers":
$("ul#card-list-submanagers li.check-item").addClass("active");
$("ul#card-list-submanagers li.check-item input[type=checkbox]").prop("checked","checked");
break;
}
$(".dropup").removeClass("open");
hide_or_show_button();
return false;
})
$("#deselect_all").on("click",function(){
switch(authorization_type){
case "managers":
$("ul#card-list-managers li.check-item").removeClass("active");
$("ul#card-list-managers li.check-item input[type=checkbox]").removeAttr("checked");
break;
case "sub_managers":
$("ul#card-list-submanagers li.check-item").removeClass("active");
$("ul#card-list-submanagers li.check-item input[type=checkbox]").removeAttr("checked");
break;
}
$(".dropup").removeClass("open");
hide_or_show_button();
return false;
})
var hide_or_show_button = function(){
if($('.selected_role input[type="checkbox"]:checked').length == 0 && $('.selected_user input[type="checkbox"]:checked').length == 0){
$("#remove_users").addClass("hide");
}else{
$("#remove_users").removeClass("hide");
}
}
var is_category_disabled = function(id){
var obj = app_categories.filter(function(c){return c.id == id})[0];
return obj.disable;
}
$("select[name=anything]").on("change",function(){
$(".select_user_modal").removeClass("hide");
$("#disabled_message_span").addClass("hide");
var value_to_filter = $(this).val();
if(value_to_filter != ""){
if(is_category_disabled(value_to_filter)){
$(".select_user_modal").addClass("hide");
$("#disabled_message_span").removeClass("hide");
}
lis.each(function(){
var categories = $(this).data("categories");
if(categories.indexOf(value_to_filter) == -1){
$(this).hide();
}else{
$(this).show();
}
})
}else{
lis.show();
}
})
$(".select_user_modal").on('click', function(){ $(".select_user_modal").on('click', function(){
var ids = []; var data_to_send = {"authorization_type" : authorization_type};
var users = $(this).siblings('.selected_users').children('span.selected_user'); if (authorization_type == "sub_managers"){
users.each(function(i) { var category_id = $("select[name=anything]").val();
ids.push(users.eq(i).attr('id')); if(category_id == ""){
}); alert("Please select a category.");
$("#main-wrap").after("<span id='select_user'></span>"); return false;
}
data_to_send.category_id = category_id;
}
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: $(this).attr("rel"), url: $(this).attr("rel"),
dataType: 'script', dataType: 'html',
data: {field: $(this).attr("field"), ids: ids}, data : data_to_send,
success: function (msg) { success: function (html) {
$("#member-filter").modal('show'); }, $("#select_user_modal").html(html);
error: function(){ $("#member-filter").modal('show');
alert("ERROR"); $(".modal").on("hidden", function () {
} $("#select_user_modal").empty();
});
var current_role = $("#select_user_modal .current_role a").eq(0).attr("href");
$("#select_user_modal .current_role a").on("click",function(){
current_role = $(this).attr("href");
})
$("#select_all_modal").on("click",function(){
$(current_role).find(".check-item").addClass("active");
$(current_role).find(".check-item input[type=checkbox]").prop("checked","checked");
$(".dropup").removeClass("open");
return false;
})
$("#deselect_all_modal").on("click",function(){
$(current_role).find(".check-item").removeClass("active");
$(current_role).find(".check-item input[type=checkbox]").removeAttr("checked");
$(".dropup").removeClass("open");
return false;
})
},
}); });
return false; return false;
}); });
@ -25,22 +132,36 @@ $(document).ready(function() {
}); });
$("#remove_users").on('click', function(){ $("#remove_users").on('click', function(){
var ids = []; var user_ids = [],
var users = $('.selected_user input[type="checkbox"]:checked'); role_ids =[],
users.each(function(i) { users = $('.selected_user input[type="checkbox"]:checked'),
ids.push(users.eq(i).parent().attr('id')); roles = $('.selected_role input[type="checkbox"]:checked');
users.each(function() {
user_ids.push($(this).parent().attr('id'));
}); });
if (users.size() > 0) {
// TODO: i18n in javascript roles.each(function() {
if (confirm('Are you sure you want to delete this?')) { role_ids.push($(this).parent().attr('id'));
});
var data_to_send = {"authorization_type" : authorization_type, "user_ids" : user_ids, "role_ids" : role_ids};
if (authorization_type == "sub_managers"){
var category_id = $("select[name=anything]").val();
data_to_send.category_id = (category_id == "" ? "all" : category_id);
}
if (user_ids.length > 0 || role_ids.length > 0) {
if (confirm('Are you sure you want revoke persmission from these users?')) { // TODO: i18n in javascript
$.ajax({ $.ajax({
type: 'DELETE', type: 'DELETE',
url: $(this).attr("rel"), url: $(this).attr("rel"),
dataType: 'script', dataType: 'script',
data: {ids: ids}, data: data_to_send,
error: function(){ error: function(){
// TODO: i18n in javascript
alert("ERROR"); alert("ERROR");
},
success : function(){
hide_or_show_button();
} }
}); });
} }

View File

@ -0,0 +1,2 @@
/* Plugin for Cycle2; Copyright (c) 2012 M. Alsup; v20141007 */
!function(a){"use strict";function b(){try{this.playVideo()}catch(a){}}function c(){try{this.pauseVideo()}catch(a){}}var d='<div class=cycle-youtube><iframe width="640" height="360" frameborder="0" allowfullscreen="" data-yt-api-binded="0" src="{{url}}"></iframe></div>';a.extend(a.fn.cycle.defaults,{youtubeAllowFullScreen:!0,youtubeAutostart:!1,youtubeAutostop:!0}),a(document).on("cycle-bootstrap",function(e,f){f.youtube&&(f.hideNonActive=!1,f.container.find(f.slides).each(function(b){if(void 0!==a(this).attr("href")){var c,e=a(this),g=e.attr("href"),h=f.youtubeAllowFullScreen?"true":"false";g+=(/\?/.test(g)?"&":"?")+"enablejsapi=1",f.youtubeAutostart&&f.startingSlide===b&&(g+="&autoplay=1"),c=f.API.tmpl(d,{url:g,allowFullScreen:h}),e.replaceWith(c)}}),f.slides=f.slides.replace(/(\b>?a\b)/,"div.cycle-youtube"),f.youtubeAutostart&&f.container.on("cycle-initialized cycle-after",function(c,d){var e="cycle-initialized"==c.type?d.currSlide:d.nextSlide;a(d.slides[e]).find("object,embed").each(b)}),f.youtubeAutostop&&f.container.on("cycle-before",function(b,d){a(d.slides[d.currSlide]).find("object,embed").each(c)}))})}(jQuery);

3508
app/assets/javascripts/select2/select2.js vendored Executable file

File diff suppressed because one or more lines are too long

23
app/assets/javascripts/select2/select2.min.js vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
//= require basic //= require basic
//= require jquery.ui.sortable //= 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

View File

@ -0,0 +1,114 @@
var _number_of_validators_ = 0;
var FormValidator = function(form){
var fv = this,
elements_data = {},
failed_elements = [];
this.form = form;
this.elements = null;
this.validate_functions = {
required : function(value,element){
switch($(element).prop("tagName")){
case "INPUT":
switch(element.attr("type")){
case "text":
return (value == "" ? false : true);
break;
case "checkbox":
return element.is(":checked");
break;
}
case "SELECT":
return (value == "" ? false : true);
break;
}
},
nospace : function(value){
return (/\s/.test(value) ? false : true);
},
lowercase : function(value){
return (value == value.toLowerCase() ? true : false);
},
email : function(value){
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(value);
},
url : function(value){
if(value == "#"){
return true;
}
var reg = new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/);
return reg.test(value);
},
urlwithip : function(value){
if(value == "#"){
return true;
}
var reg = new RegExp(/^https?\:\/\/[^\/\s]+(\/.*)?$/);
return reg.test(value);
}
}
this.initialize = function(){
fv.elements = fv.form.find("*[data-fv-validation]");
_number_of_validators_++;
_putFieldsValidatorAndMessage();
_attachSubmitHandler();
}
var _attachSubmitHandler = function(){
fv.form.on("submit",function(){
return fv.isFormValidated();
})
}
this.isFormValidated = function(){
failed_elements = [];
$.each(elements_data,function(key,element){
var validators = element.validators,
messages = element.messages,
el = fv.form.find("#" + key);
for(i = 0; i < validators.length; i++){
var error_span = (fv.form.find("div[for=" + key + "]").length ? $("div[for=" + key + "]") : $("<div class='validator_error_class text-error' for='" + key + "'></div>"));
if(typeof fv.validate_functions[validators[i]] == "function"){
if(!fv.validate_functions[validators[i]](el.val(),el)){
error_span.text(messages[i]);
el.after(error_span);
failed_elements.push(el);
break;
}else{
error_span.remove();
}
}else{
console.info("Not validating for " + validators[i] + ". Skipping.");
}
}
})
if(failed_elements.length){
var offset = failed_elements[0].offset().top - fv.form.offset().top + fv.form.scrollTop();
fv.form.parent().animate({scrollTop:offset-50}, '300', 'swing');
return false;
}else{
return true;
}
}
var _putFieldsValidatorAndMessage = function(){
$.each(fv.elements,function(i,element){
var element = $(element),
validators = element.data("fv-validation").split(";").slice(0,-1),
messages = element.data("fv-messages").split(";").slice(0,-1),
id = (typeof element.attr("id") == "undefined" ? _generateElementId(element) : element.attr("id"));
elements_data[id] = {};
elements_data[id].validators = validators;
elements_data[id].messages = messages;
})
}
var _generateElementId = function(element){
var name = element.attr("name").replace(/\[+(.*?)\]+/g,"$1") + "_" + _number_of_validators_;
element.attr("id",name);
return name;
}
this.initialize();
}

View File

@ -0,0 +1,258 @@
.panel{
position: relative;
border-radius: 5px;
overflow: hidden;
border: 1px solid #DFDFDF;
background: #FFF;
box-shadow: 0px 0px 10px #CCC;
.installed-templates-search,
.templates-store-search {
position: absolute;
top: 5px;
right: 5px;
@media screen and (max-width: 479px) {
.search {
width: 130px;
}
}
}
}
.break{
border-left: 1px solid #FCFCFC;
border-right: 1px solid #DDD;
padding: 10px 0;
margin: 0 15px;
}
.panel-heading{
font-size: 16px;
color: #666;
padding: 10px 20px;
height: 20px;
background-color: #fafafa;
background-image: -moz-linear-gradient(top, #ffffff, #f2f2f2);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f2f2f2));
background-image: -webkit-linear-gradient(top, #ffffff, #f2f2f2);
background-image: -o-linear-gradient(top, #ffffff, #f2f2f2);
background-image: linear-gradient(to bottom, #ffffff, #f2f2f2);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0);
*zoom: 1;
border-bottom: 1px solid #DDD;
& > ul {
list-style: none;
margin: 0;
padding: 0;
}
li {
display: inline-block;
border-right: 1px solid #FCFCFC;
margin-top: -10px;
padding-top: 10px;
padding-right: 15px;
padding-bottom: 10px;
& + li {
border-left: 1px solid #DDD;
margin-left: -3px;
padding-left: 15px;
}
&:last-child {
border-right: none;
}
&.active {
a {
color: #0088cc;
}
}
@media screen and (max-width: 767px) {
.translation_missing {
display: none;
}
}
}
a {
color: #666;
&:hover {
text-decoration: none;
}
}
}
.table{
margin: 0;
-webkit-border-radius: 5px;
border-radius: 5px;
.toggle-control {
margin-bottom: 0;
}
}
.table td{
vertical-align: middle;
}
.table td img{
background: #666;
border: 3px solid #AAA;
padding: 2px;
border-radius: 5px;
box-shadow: 0px 0px 10px #000 inset;
}
.pannel-body {
padding: 15px 0;
.pannel-body-inner {
min-height: 400px;
max-height: 600px;
padding: 0 15px;
overflow: auto;
}
}
.store-item-list {
&:after {
content: '';
clear: both;
display: table;
}
.store-item {
float: left;
padding: 5px;
box-sizing: border-box;
border-style: solid;
border-color: #ededed;
border-width: 0;
border-top-width: 1px;
border-bottom-width: 1px;
border-right-width: 1px;
@media screen and (min-width: 996px) {
width: 25%;
&:nth-child(n+5) {
border-top-width: 0;
}
&:nth-child(4n+1) {
border-left-width: 1px;
}
}
@media screen and (min-width: 768px) and (max-width: 995px) {
width: 33%;
&:nth-child(n+4) {
border-top-width: 0;
}
&:nth-child(3n+1) {
border-left-width: 1px;
}
}
@media screen and (min-width: 480px) and (max-width: 767px) {
width: 50%;
&:nth-child(n+3) {
border-top-width: 0;
}
&:nth-child(2n+1) {
border-left-width: 1px;
}
}
@media screen and (max-width: 479px) {
width: 100%;
border-left-width: 1px;
& + .store-item {
border-top-width: 0;
}
}
&:after {
content: '';
clear: both;
display: table;
}
}
.app-pic {
float: left;
width: 80px;
height: 80px;
margin-right: 10px;
overflow: hidden;
border-radius: 3px;
}
.app-name,
.app-author,
.app-category {
width: calc(100% - 90px);
margin-top: 0;
margin-bottom: 3px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.app-name {
a {
color: #333;
&:hover {
text-decoration: none;
}
}
}
.app-category {
color: #C3C3C3;
}
}
.pannel-footer{
background: #f2f2f2; /* Old browsers */
background: -moz-linear-gradient(top, #f2f2f2 0%, #ffffff 76%, #ededed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f2f2f2), color-stop(76%,#ffffff), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f2f2f2 0%,#ffffff 76%,#ededed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f2f2f2 0%,#ffffff 76%,#ededed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #f2f2f2 0%,#ffffff 76%,#ededed 100%); /* IE10+ */
background: linear-gradient(to bottom, #f2f2f2 0%,#ffffff 76%,#ededed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f2f2f2', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
border: 1px solid #EEE;
border-top: 1px solid #CCC;
padding: 10px;
height: 30px;
}
#apply_change_btn{
display: none;
}
#alert_wrap{
display: none;
position: absolute;
width: 93%;
top: 30%;
z-index: 1045;
}
.alert{
width: 400px;
text-align: center;
z-index: 1050;
margin: 0 auto;
padding: 20px 0;
}
#delete_confirm_wrap{
display: none;
position: absolute;
width: 93%;
top: 30%;
z-index: 1045;
}
#delete_confirm_wrap .alert{
width: 260px;
text-align: left;
padding: 20px;
font-size: 14px;
line-height: 32px;
}
.modal-backdrop{
display: none;
}
.icons-faq:before{ content: "\e086"; }
.icons-ask:before { content: "\e062"; }
.icons-survey:before { content: "\e070"; }

View File

@ -14,3 +14,8 @@
*= require lib/filter *= require lib/filter
*= require lib/pageslide *= require lib/pageslide
*/ */
/* Hide ckeditor text, it's breaking the layout but we need to keep them for future use */
.ui-helper-hidden-accessible {
display: none;
}

View File

@ -49,7 +49,7 @@ input:focus::-webkit-input-placeholder {
color: transparent; color: transparent;
} }
body { body {
background-color: #F3F3F3; background-color: #f3f3f3;
font-family: 'Chivo'; font-family: 'Chivo';
} }
body.modalBlur > nav, body.modalBlur > nav,
@ -122,6 +122,20 @@ legend {
text-align: center; text-align: center;
list-style: none; list-style: none;
} }
#sidebar .sidebar-nav .license-denied {
cursor: not-allowed;
}
#sidebar .sidebar-nav .license-denied > span {
position: relative;
width: 60px;
}
#sidebar .sidebar-nav .license-denied > span:before {
position: absolute;
top: 10px;
left: 12px;
font-size: 3.1em;
color: rgba(205, 10, 10, 0.46);
}
#sidebar > h2.position { #sidebar > h2.position {
margin: 0; margin: 0;
width: 61px; width: 61px;
@ -188,6 +202,7 @@ legend {
} }
#sidebar .sidebar-nav > li a { #sidebar .sidebar-nav > li a {
display: block; display: block;
text-decoration: none;
} }
#sidebar .sidebar-nav > li i { #sidebar .sidebar-nav > li i {
font-size: 1.6em; font-size: 1.6em;
@ -304,6 +319,18 @@ legend {
background-color: rgba(0, 136, 204, .6); background-color: rgba(0, 136, 204, .6);
} }
/* sidebar on */
#sidebar.on ~ #main-wrap .fc-border-separate {
table-layout: fixed;
}
#sidebar.on ~ #main-wrap .fc-view-month .fc-day-header {
width: auto !important;
}
#sidebar.on ~ #main-wrap .fc-view-agendaWeek .fc-widget-header.fc-last {
width: 15px !important;
}
/* Main Wrap */ /* Main Wrap */
#main-wrap { #main-wrap {
@ -327,7 +354,7 @@ legend {
top: 50px; top: 50px;
} }
#member-filter .modal-body { #member-filter .modal-body {
max-height: 425px; max-height: 500px;
} }
#member-filter .modal-body form { #member-filter .modal-body form {
margin-bottom: 0px; margin-bottom: 0px;
@ -397,6 +424,10 @@ legend {
border-color: #ddd transparent #ddd #ddd; border-color: #ddd transparent #ddd #ddd;
*border-right-color: #ffffff; *border-right-color: #ffffff;
} }
#member-filter .tab-content-1 {
padding-left: 15px;
border-left: 1px solid #ddd;
}
#member-filter .member-filter-options { #member-filter .member-filter-options {
float: left; float: left;
display: inline-block; display: inline-block;
@ -760,6 +791,15 @@ legend {
display: block; display: block;
} }
.simple-date-picker input:first-child {
margin-right: 3px;
}
.simple-date-picker select {
margin-right: 3px;
}
/* IE go die */ /* IE go die */
:root #sidebar .sub-nav-block:before { :root #sidebar .sub-nav-block:before {
display: block\9; display: block\9;

View File

@ -18,17 +18,14 @@
/* Font Awesome styles /* Font Awesome styles
------------------------------------------------------- */ ------------------------------------------------------- */
/* includes sprites.less reset */ /* includes sprites.less reset */
.ui-icon,
[class^="icon-"], [class^="icon-"],
[class*=" icon-"] { [class*=" icon-"] {
font-family: 'FontAwesome'; font-family: 'FontAwesome';
} }
.ui-icon,
[class^="icons-"], [class^="icons-"],
[class*=" icons-"] { [class*=" icons-"] {
font-family: 'entypo'; font-family: 'entypo';
} }
.ui-icon,
[class^="icon"], [class^="icon"],
[class*=" icon"] { [class*=" icon"] {
font-weight: normal; font-weight: normal;
@ -46,7 +43,6 @@
} }
.ui-icon,
[class^="icon"]:before, [class^="icon"]:before,
[class*=" icon"]:before { [class*=" icon"]:before {
text-decoration: inherit; text-decoration: inherit;
@ -54,7 +50,6 @@
speak: none; speak: none;
} }
/* makes sure icons active on rollover in links */ /* makes sure icons active on rollover in links */
a .ui-icon,
a [class^="icon"], a [class^="icon"],
a [class*=" icon"] { a [class*=" icon"] {
display: inline-block; display: inline-block;
@ -64,8 +59,6 @@ a [class*=" icon"] {
vertical-align: -10%; vertical-align: -10%;
font-size: 1.3333333333333333em; font-size: 1.3333333333333333em;
} }
.btn .ui-icon
.nav .ui-icon,
.btn [class^="icon"], .btn [class^="icon"],
.nav [class^="icon"], .nav [class^="icon"],
.btn [class*=" icon"], .btn [class*=" icon"],
@ -74,22 +67,18 @@ a [class*=" icon"] {
/* keeps button heights with and without icons the same */ /* keeps button heights with and without icons the same */
line-height: .6em; line-height: .6em;
} }
.btn .ui-icon.icon-spin,
.nav .ui-icon.icon-spin,
.btn [class^="icon"].icon-spin, .btn [class^="icon"].icon-spin,
.nav [class^="icon"].icon-spin, .nav [class^="icon"].icon-spin,
.btn [class*=" icon"].icon-spin, .btn [class*=" icon"].icon-spin,
.nav [class*=" icon"].icon-spin { .nav [class*=" icon"].icon-spin {
display: inline-block; display: inline-block;
} }
li .ui-icon,
li [class^="icon"], li [class^="icon"],
li [class*=" icon"] { li [class*=" icon"] {
display: inline-block; display: inline-block;
width: 1.25em; width: 1.25em;
text-align: center; text-align: center;
} }
li .ui-icon.icon-large,
li [class^="icon"].icon-large, li [class^="icon"].icon-large,
li [class*=" icon"].icon-large { li [class*=" icon"].icon-large {
/* increased font size for icon-large */ /* increased font size for icon-large */
@ -100,7 +89,6 @@ ul.icons {
list-style-type: none; list-style-type: none;
text-indent: -0.75em; text-indent: -0.75em;
} }
ul.icons li .ui-icon,
ul.icons li [class^="icon"], ul.icons li [class^="icon"],
ul.icons li [class*=" icon"] { ul.icons li [class*=" icon"] {
width: .75em; width: .75em;

View File

@ -3,7 +3,7 @@
left: -10px; left: -10px;
right: -10px; right: -10px;
height: 40px; height: 40px;
z-index: 1041; z-index: 1040;
position: fixed; position: fixed;
margin-bottom: 0; margin-bottom: 0;
} }
@ -16,7 +16,7 @@
background-repeat: no-repeat; background-repeat: no-repeat;
background-image: url('<%= asset_path 'orbit-logo.svg' %>'); background-image: url('<%= asset_path 'orbit-logo.svg' %>');
/* For Suck IE */ /* For IE */
background-image: url('<%= asset_path 'orbit-logo.png' %>'); background-image: url('<%= asset_path 'orbit-logo.png' %>');
} }
#orbit-bar.navbar .nav > li > a { #orbit-bar.navbar .nav > li > a {
@ -295,14 +295,16 @@
/* Responsive */ /* Responsive */
@media (max-width: 480px) { @media (max-width: 630px) {
#orbit-bar .navbar-inner .nav { #orbit-bar .navbar-inner .nav {
margin-right: 0; margin-right: 0;
} }
#orbit-bar #orbit-user span, #orbit-bar #orbit-user span{
#orbit-bar #search {
display: none; display: none;
} }
#orbit-bar #search input[type="text"] {
width: 80px;
}
#orbit-bar #orbit-language [class^="flag-"], #orbit-bar #orbit-language [class^="flag-"],
#orbit-bar #orbit-language [class*=" flag-"] { #orbit-bar #orbit-language [class*=" flag-"] {
margin: -8px; margin: -8px;
@ -315,3 +317,15 @@
margin-left: -175px; margin-left: -175px;
} }
} }
@media (max-width: 640px) {
#orbit-bar .orbit-bar-search-sign-language #search input[type="search"] {
width: 100px;
}
}
@media (max-width: 430px) {
#orbit-bar #search{
display: none;
}
}

View File

@ -0,0 +1,65 @@
@charset "utf-8";
@import url(http://fonts.googleapis.com/css?family=Ubuntu:400,400italic);
body {
font-family: "Ubuntu", sans-serif;
font-size: 100%;
padding: 8rem 0 0 0;
background: url(/assets/google-message-background.jpg) center center fixed;
background-size: cover;
}
.message-wrap {
width: 80%;
max-width: 366px;
margin: auto;
padding: 2rem;
text-align: center;
border: 2px solid rgba(255, 255, 255, .1);
border-radius: 4px;
background: rgba(255, 255, 255, .1);
}
.message-image-wrap {
position: relative;
display: inline-block;
width: 100px;
}
.message-image {
width: 100px;
height: 100px;
margin: 3rem 0 1.875rem 0;
border-radius: 50%;
}
.message-body .message-icon {
font-size: 1.2rem;
line-height: 50px;
position: absolute;
right: -1.625rem;
bottom: 1rem;
display: block;
width: 50px;
height: 50px;
color: #fff;
border-radius: 50%;
}
.message-heading {
font-size: 1.75rem;
font-weight: normal;
margin-bottom: .5rem;
text-transform: uppercase;
color: #fff;
}
.message-paragraph {
font-size: .9rem;
font-style: italic;
margin-bottom: 1rem;
color: rgba(255, 255, 255, .8);
}
.success-skin {
background: #37be1c;
}
.fail-skin {
background: #cc1c1c;
}
.info-skin {
background: #1cadcc;
}

View File

@ -17,8 +17,24 @@
.mini-layout .mini-layout-sidebar .pane { .mini-layout .mini-layout-sidebar .pane {
right: 0px; right: 0px;
} }
.mini-layout .nav-tabs {
margin-bottom: 0;
}
.mini-layout .tab-pane {
min-height: 600px;
padding: 20px 10px;
background-color: #fff;
border: 1px solid #ddd;
border-top: none;
}
.mini-layout .tab-pane-head {
border-bottom: 1px solid #ddd;
}
.mini-layout .tab-pane-head select {
margin: 5px;
}
.checkbox-card { .checkbox-card {
margin: 0; margin: 1em 0 0;
} }
.checkbox-card li { .checkbox-card li {
position: relative; position: relative;
@ -49,6 +65,19 @@
opacity: 0; opacity: 0;
visibility: hidden; visibility: hidden;
} }
.checkbox-card li.role {
background-color: #696969;
}
.checkbox-card li.role label {
padding: 10px;
line-height: 26px;
}
.checkbox-card li.role span {
display: inline-block;
width: auto;
color: #FFF;
}
.checkbox-card li:hover { .checkbox-card li:hover {
background-color: #0088cc; background-color: #0088cc;
} }
@ -107,6 +136,14 @@
color: #666666; color: #666666;
margin-top: -3px; margin-top: -3px;
} }
.checkbox-card li label span.badge {
float: right;
margin-top: 1px;
color: #fff;
}
.checkbox-card li span.role-name {
width: 80%;
}
.checkbox-card li:hover label span, .checkbox-card li:hover label span,
.checkbox-card li:hover label span.user-name { .checkbox-card li:hover label span.user-name {
color: #FFFFFF; color: #FFFFFF;

View File

@ -0,0 +1,110 @@
@charset "utf-8";
@import "group-variables";
// Group category page
.group-category {
margin-bottom: 16px;
}
.group-category-tab {
.group-category-tab-nav {
font-size: 0.8125rem;
padding: 10px 12px;
}
.active {
.group-category-tab-nav {
background-color: $blue;
&:hover {
background-color: lighten($blue, 5%);
}
}
}
}
.group-category-item {
float: left;
margin: 0 0.625rem 1rem 0;
background-color: $green;
&:hover {
background-color: lighten($green, 5%);
}
.group-category-tag-icon {
font-size: 1rem;
vertical-align: middle;
}
a {
font-size: 0.8125rem;
font-family: $sub-font;
color: $white;
}
}
.group-category-request {
.group-category-item {
background-color: darken($dark-gray, 25%);
}
}
.group-category-tab-content {
border-top: 1px solid #ddd;
padding: 16px 0;
overflow: visible;
}
.group-category-controls {
margin-left: 8px;
a {
padding: 2px 0.4rem;
color: $white;
display: inline-block;
border-radius: 50%;
}
.group-category-approve {
background-color: $green;
}
.group-category-reject {
background-color: $red;
}
}
.group-category-approve-tootip {
white-space: nowrap;
}
.card-ownership {
border-top: 6px solid darken($gray, 7%);
&:before {
border-top-left-radius: $general;
content: "";
height: 6px;
width: 80%;
position: absolute;
left: 0;
top: -6px;
}
}
.card-owner {
&:before {
background-color: lighten($blue, 10%);
}
}
.card-public {
&:before {
background-color: lighten($green, 10%);
}
}
.card-member {
&:before {
background-color: lighten($red, 20%);
}
}

View File

@ -0,0 +1,306 @@
@charset "utf-8";
@import "group-variables";
// Genernal classes and modules
.screen-reader {
position: absolute;
top: -9999px;
left: -9999px;
}
.img-reponsive {
max-width: 100%;
width: 100%;
height: auto;
}
.wrapper {
margin: auto;
max-width: $boundary;
}
.radius {
border-radius: $general;
}
// Buttons
.button {
padding: 8px .75rem;
color: $black;
border: none;
border-radius: 15rem;
background: $gray;
}
.button-default {
color: $blue;
background-color: transparent;
border: 2px solid $blue;
transition: $fast all;
&:hover {
color: $white;
background-color: $blue;
}
&.gray {
color: $dark-gray;
border: 2px solid $dark-gray;
&:hover {
color: $white;
background-color: $dark-gray;
}
}
}
.button-activated {
color: #fff;
background-color: $green;
}
.button-primary {
color: $white;
background-color: $blue;
transition: $fast all;
&:hover {
color: $white;
background-color: darken($blue, 15%);
}
}
.button-small {
padding: 4px 0.625rem;
font-size: 0.75rem;
}
.button-large {
padding: 14px 1.3rem;
}
// Button group
.button-group {
display: inline-block;
list-style: none;
> .button-group-common {
display: inline-block;
}
> .button:first-child {
border-radius: 15rem 0 0 15rem;
margin-right: -4px;
}
> .button:last-child {
border-radius: 0 15rem 15rem 0;
}
li {
color: $blue;
background-color: rgba($white, 0.2);
&:hover {
a {
color: $white;
}
}
}
> .active {
color: $white;
background-color: $blue;
a {
color: $white;
}
}
}
// Tool Tip
.tool-tip-parent {
position: relative;
&:hover {
.tool-tip {
display: block;
}
}
}
.tool-tip {
padding: 10px 0.75rem;
border-radius: .2rem;
color: $white;
background: rgba($black, 0.85);
position: absolute;
left: 0;
bottom: 100%;
z-index: 150;
display: none;
&:after {
border: 5px solid transparent;
border-top-color: rgba($black, 0.85);
content: "";
position: absolute;
left: 10px;
bottom: -10px;
}
&.right {
left: auto;
right: 0;
&:after {
left: auto;
right: 10px;
}
}
&.bottom {
top: 100%;
bottom: auto;
&:after {
top: -10px;
bottom: auto;
border-top-color: transparent;
border-bottom-color: rgba(0, 0, 0, 0.85);
}
}
&.nowrap {
white-space: nowrap;
}
}
.action {
position: relative;
.toggle {
border: none;
border-left: 1px solid darken($gray, 6%);
border-bottom: 1px solid darken($gray, 6%);
background: none;
padding: 2px 8px;
transition: $fast all;
&:hover, &.open {
border-color: $blue;
background: $blue;
.caret {
border-top-color: $white;
}
}
}
&:hover, &.open {
border-radius: $general;
background: $blue;
.caret {
border-top-color: $white;
}
}
.caret {
border-top-color: darken($gray, 30%);
vertical-align: middle;
}
.action-dropdown {
display: none;
position: absolute;
right: 0;
top: 102%;
list-style: none;
margin: 0;
padding: 0;
background: $white;
border: 1px solid darken($gray, 6%);
border-radius: $general;
box-shadow: 0 1px 3px 0 rgba($black, 0.2);
a {
display: block;
padding: 3px 12px;
white-space: nowrap;
&:hover {
color: $white;
background-color: $blue;
}
}
&.open {
display: block;
}
}
}
.card {
border-radius: $general;
background: $white;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2);
transition: $normal box-shadow;
&:hover {
box-shadow: 0 1px 25px 0 rgba(0, 0, 0, 0.2);
}
}
// responsive grid
.square {
float: left;
position: relative;
width: 20%;
padding-bottom: 20%;
margin: 1%;
background-color: $white;
overflow: hidden;
.content {
position: absolute;
height: 90%;
width: 90%;
padding: 5%;
.rs {
width: auto;
height: auto;
max-height: 90%;
max-width: 100%;
}
}
.table {
display: table;
width: 100%;
height: 100%;
}
.table-cell {
display: table-cell;
vertical-align: middle;
}
}
// avatar
.admin-avatar {
width: 60px;
height: 60px;
max-width: none;
border-radius: $round;
}
// breadcrumb
.breadcrumb {
padding-left: 0;
margin: 0;
background: none;
> li {
text-shadow: none;
font-size: 13px;
}
}

View File

@ -0,0 +1,227 @@
@charset "utf-8";
@import "group-variables";
// Group index and public
#main-wrap .wrap-inner {
padding: 80px 20px 20px;
}
.group-public,
.group-index {
margin: auto;
max-width: 1500px;
}
.group-card {
list-style: none;
margin-bottom: 20px;
}
.group-card-action {
position: absolute;
right: 12px;
top: 6px;
z-index: 200;
.group-card-dropdown-toggle {
border: 1px solid darken($gray, 6%);
border-radius: $general;
&:hover {
border-radius: $general;
}
}
.group-card-dropdown {}
}
.group-card-inner {
padding: 2.6rem 0.8rem;
position: relative;
min-height: 280px;
hr {
margin: 8px 0 10px 0;
}
}
.group-avatar {
position: relative;
width: 100%;
height: 200px;
overflow: hidden;
background: $dark-gray;
z-index: 100;
&:hover .action {
z-index: 600;
opacity: 1;
}
img {
width: 100%;
height: auto;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 500;
margin: auto;
}
.action {
opacity: 0;
background: rgba($blue, 0.9);
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
}
.edit {
color: $white;
font-size: 25px;
position: absolute;
top: 50%;
left: 45%;
transform: translate(-50%, -50%);
margin: auto;
}
.trash {
color: $red;
font-size: 25px;
position: absolute;
top: 49%;
left: 60%;
transform: translate(-50%, -50%);
margin: auto;
}
}
.group-info {
overflow: hidden;
}
.group-mail {
color: $dark-gray;
font-family: $sub-font;
}
.group-roles {
list-style: none;
margin: 0;
padding: 0;
font-family: $sub-font;
.label {
font-family: $main-font;
text-transform: capitalize;
text-shadow: none;
}
.label.private {
background-color: $red;
}
.label.public {
background-color: #74c25d;
}
}
.group-privacy {
color: $dark-gray;
margin-bottom: 8px;
}
.group-description {
overflow: hidden;
max-height: 150px;
}
.group-name {
margin-bottom: 4px;
}
// 370px
@media screen and (min-width: 23.125rem) {
.group-index {
width: 90%;
}
.group-card {
width: 100%;
}
}
// 600px
@media screen and (min-width: 37.5rem) {
.group-index {
margin-top: 0;
width: 100%;
}
.group-card {
float: left;
padding: 0 0.5rem;
width: 50%;
&:nth-child(2n+1) {
clear: both;
padding-left: 0;
}
}
}
// 900px
@media screen and (min-width: 56.25rem) {
.group-card {
width: 33.3%;
&:nth-child(2n+1) {
clear: none;
padding-left: 0.5rem;
}
&:nth-child(3n+1) {
clear: both;
padding-left: 0;
}
}
}
// 1080px
@media screen and (min-width: 67.5rem) {
.group-card {
width: 25%;
&:nth-child(3n+1) {
clear: none;
padding-left: 0.5rem;
}
&:nth-child(4n+1) {
clear: both;
padding-left: 0;
}
}
}
// 1400px
@media screen and (min-width: 87.5rem) {
.group-card {
width: 20%;
&:nth-child(4n+1) {
clear: none;
padding-left: 0.5rem;
}
&:nth-child(5n+1) {
clear: both;
padding-left: 0;
}
}
}

View File

@ -0,0 +1,154 @@
@import "group-variables";
// Group page
#main-wrap {
padding-top: 0;
.wrap-inner {
// padding: 0;
}
}
.group-member-banner-wrap {
height: 280px;
overflow: hidden;
position: fixed;
top: 0;
left: 0;
width: 100%;
transition: $fast all;
z-index: 500;
background: lighten($black, 25%);
}
.group-member-bar {
padding: 0 2rem 0 6rem;
background: rgba(25, 27, 29, 0.95);
width: 100%;
position: absolute;
left: 0;
bottom: 0;
}
.group-member-page-title {
margin-bottom: 12px;
padding: 6px 0;
color: $white;
font-family: $main-font;
font-weight: normal;
max-width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.group-member-dropdown {
margin: 12px 0;
> button {
padding: 8px 0.75rem;
}
.badge {
margin-left: 4px;
}
}
.group-member-section {
overflow: hidden;
padding: 220px 2rem 30px;
}
.group-member-list {
padding: 0;
margin: 0;
}
.group-member-item {
list-style: none;
padding: 16px 1rem;
margin: 8px 0 12px 0;
}
.group-member-photo-wrap {
display: inline-block;
vertical-align: top;
margin-right: 0.5rem;
}
.group-member-meta-wrap {
display: inline-block;
vertical-align: top;
width: 50%;
}
.group-member-name {
font-size: 0.8125rem;
}
.group-member-photo {
width: 60px;
height: 60px;
border-radius: $round;
}
// scroll view
.group-member.scroll {
padding-top: 2rem;
padding-bottom: 9rem;
.group-member-page-title {
margin-top: 0;
margin-bottom: 0;
font-size: 1.625rem;
line-height: 50px;
}
.group-member-banner-wrap {
height: 120px;
}
.group-member-page-title {
margin-bottom: 0;
font-size: 1.625rem;
line-height: 50px;
}
.group-member-section {
padding-top: 60px;
}
}
// 620
@media screen and (min-width: 38.75rem) {
.group-member-item {
float: left;
margin-right: 1rem;
width: 45%;
}
}
// 980px
@media screen and (min-width: 61.25rem) {
.group-member-content-wrap {
width: 70%;
}
.group-member-item {
width: 30%;
}
.group-member-page-title {
display: inline-block;
margin: 0;
padding: 0;
line-height: 70px;
transition: .6s all;
}
}
// 1400px
@media screen and (min-width: 87.5rem) {
.group-member-item {
width: 20%;
}
}

View File

@ -0,0 +1,394 @@
@charset "utf-8";
@import "group-variables";
// Group page
#main-wrap {
padding-top: 0;
}
.group-post-banner-wrap {
height: 280px;
overflow: hidden;
position: fixed;
top: 0;
left: 0;
width: 100%;
transition: $fast all;
z-index: 500;
background: lighten($black, 25%);
}
.group-post-banner-image-wrap {
background-color: $black;
text-align: center;
}
.group-post-view-switch {
position: absolute;
top: 4rem;
right: 2rem;
}
.group-post-banner-image {
width: auto;
max-width: 100%;
height: auto;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
}
.group-post-bar {
padding: 0 2rem 0 6rem;
text-align: center;
background: rgba(25, 27, 29, 0.95);
width: 100%;
position: absolute;
left: 0;
bottom: 0;
}
.group-post-view-switch-in-bar {
display: none;
.button {
padding: 3px .75rem;
}
}
.group-post-page-title {
margin-bottom: 12px;
padding: 6px 0;
color: $white;
font-family: $main-font;
font-weight: normal;
max-width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.group-post-section {
overflow: hidden;
padding: 300px 2rem 30px;
}
.breadcrumb {
li {
overflow: hidden;
max-width: 150px;
display: inline-block;
vertical-align: middle;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.gorup-page-info-wrap {
font-size: .9rem;
padding: 6px 1rem;
display: block;
float: right;
cursor: pointer;
}
.group-post-description-wrap {
clear: both;
}
.gorup-page-info-wrap {
margin-bottom: 10px;
text-align: right;
}
.group-post-status-wrap {
font-size: .75rem;
float: right;
padding: 2px 0.5rem;
margin-bottom: 10px;
}
.group-post-status-wrap.close-eye {
margin-left: 5px;
background: $red;
}
.group-post-description-wrap {
margin-bottom: 15px;
padding: 16px 1.2rem 16px;
border-radius: .2rem;
box-shadow: inset 0 0 8px $dark-gray;
}
.group-post-description {
clear: both;
text-align: justify;
}
.group-post-member-count,
.group-post-no-member {
background: $blue;
color: $white;
padding: 6px 0.625rem;
border-radius: $general;
&:hover {
background: darken($blue, 10%);
color: $white;
}
}
.group-post-item {
position: relative;
clear: both;
margin-bottom: 40px;
padding: 28px 1.5rem;
text-align: center;
&.clickable {
cursor: pointer;
}
&:hover {
.group-post-title {
color: $blue;
}
}
}
.group-post-actions {
position: absolute;
right: 0;
top: 0;
}
.group-post-dropdown-toggle {
&:hover, &.open {
.caret {
}
}
.caret {
}
}
.group-post-dropdown {
a {
&:hover {
}
}
&.open {
}
}
.group-post-action-hint {
white-space: nowrap;
}
.group-post-image-wrap {
display: inline-block;
margin-bottom: 12px;
}
.group-post-image {
width: 100%;
max-width: 100%;
height: auto;
margin-top: 12px;
border: 2px solid $gray;
border-radius: $general;
}
.group-post-content {
margin-bottom: .5rem;
color: $dark-gray;
overflow: hidden;
}
.group-post-title {
font-size: 1.5rem;
font-weight: normal;
line-height: 1;
margin-bottom: 12px;
color: $light-black;
font-family: $paragraph-font;
}
.group-post-sub-wrap {
display: inline-block;
}
.group-post-meta-wrap {
color: $dark-gray;
}
.group-post-author,
.group-post-sub-wrap {
margin-right: .5rem;
}
.group-post-seen-by {
display: inline-block;
}
.group-post-seen-by-lead {
font-style: normal;
}
// scroll view
.group-post.scroll {
padding-top: 7rem;
padding-bottom: 6rem;
.group-post-banner-wrap {
height: 120px;
}
.group-post-page-title {
margin-bottom: 0;
font-size: 1.625rem;
line-height: 50px;
}
.group-post-new-post,
.group-post-join {
margin-top: 12px;
padding: 6px 10px;
}
.group-post-new-post {
display: inline-block;
vertical-align: top;
}
.group-post-view-switch {
position: static;
display: inline-block;
margin: 6px .5rem 0 0;
display: none;
}
.group-post-view-switch-in-bar {
display: inline-block;
margin-top: 12px;
.button {
padding: 4px .75rem;
}
}
.group-post-section {
padding-top: 60px;
}
.btn {
padding: 2px 5px;
}
}
.group-post li a {
text-decoration: none;
text-align: left;
}
.group-post-switch-btn {
color: $blue;
&:hover {
color: $white;
}
}
// 400px
@media screen and (min-width: 25rem) {
.group-post-new-post,
.group-post-join {
margin: 0 0.625rem 16px;
float: none;
display: inline-block;
}
.group-post-view-switch-in-bar {
float: none;
margin: 0;
.button {
padding: 6px .75rem;
}
}
}
// 600px
@media screen and (min-width: 37.5rem) {
.group-post-item {
margin-bottom: 35px;
text-align: left;
}
.group-post-image-wrap {
float: left;
width: 12%;
min-width: 100px;
margin-right: 4%;
max-height: 140px;
overflow: hidden;
}
.group-post-content-wrap {
float: left;
width: 70%;
font-family: $paragraph-font;
}
}
/* 760px */
@media screen and (min-width: 47.5rem) {
.group-post-content-wrap {
width: 70%;
}
.group-post-bar {
text-align: left;
}
.group-post-page-title {
display: inline-block;
margin: 0;
padding: 0;
line-height: 70px;
transition: .6s all;
max-width: 80%;
}
.group-post-new-post,
.group-post-join {
float: right;
margin: 18px 0 0 0;
}
.group-post-view-switch-in-bar {
margin: 18px 8px 0 0;
float: right;
li {
padding: 8px .75rem;
}
}
.group-post-view-switch {
float: right;
}
}
// 900px
@media screen and (min-width: 56.25rem) {
.group-post-content-wrap {
width: 80%;
}
}

View File

@ -0,0 +1,38 @@
@charset "utf-8";
@import "group-variables";
// General style
body {
background: $gray;
font-family: $main-font;
}
.group-show-post-respond-comment,
ul, li, div, img {
box-sizing: border-box;
}
h1, h2, h3, h4, h5, h6, label, legend {
font-family: $main-font;
}
img {
max-width: 100%;
height: auto;
}
a {
color: $blue;
text-decoration: none;
&:hover {
color: lighten($blue, 5%);
text-decoration: none;
}
}
a, button {
&:focus {
outline: none;
}
}

View File

@ -0,0 +1,308 @@
@charset "utf-8";
@import "group-variables";
// Group show post
.group-show-post {
padding: 0 2rem 30px;
}
.group-show-post-meta {
margin-bottom: 15px;
}
.group-show-post-title {
font-family: $main-font;
float: left;
width: 90%;
font-weight: normal;
line-height: 1;
}
.group-show-post-avatar-wrap {
float: right;
padding: 0 0.375rem 0 0;
}
.group-show-post-avatar-username-toggle {
display: block;
}
.group-show-post-avatar {
width: 60px;
height: 60px;
border-radius: 50%;
}
.group-show-post-username {
display: none;
top: 100%;
padding-bottom: 30px;
right: 0;
left: auto;
white-space: nowrap;
font-size: 0.75rem;
&:after {
border-top-color: transparent;
border-bottom-color: rgba(0, 0, 0, 0.85);
top: -10px;
left: auto;
right: 20px;
bottom: auto;
}
}
.group-show-post-postdate {
display: inline-block;
clear: both;
}
.group-show-post-image-wrap {
position: relative;
background: $black;
overflow: hidden;
&:hover {
.cycle-nav {
opacity: 1;
}
.group-show-post-cycle-prev {
left: 2rem;
}
.group-show-post-cycle-next {
right: 2rem;
}
}
}
.group-show-post-image-list {
margin: 0;
padding: 0;
list-style: none;
}
.cycle-nav {
font-size: 1.2rem;
position: absolute;
top: 50%;
margin-top: -1.25rem;
line-height: 1.5rem;
color: $white;
z-index: 500;
width: 2.5rem;
height: 2.5rem;
cursor: pointer;
-webkit-transition: $fast all;
transition: $fast all;
text-align: center;
background-color: rgba($black, 0.8);
border-radius: 50%;
opacity: 0;
&:hover {
background-color: $blue;
}
.group-show-post-cycle-nav-icon {
line-height: 2.6rem;
}
}
.group-show-post-cycle-prev {
left: 0;
}
.group-show-post-cycle-next {
right: 0;
}
.group-show-post-content {
font-family: $main-font;
font-size: .8125rem;
margin: 15px 0;
}
.group-show-post-attachment-wrap {
float: left;
width: 80%;
margin: 10px 0 25px;
.group-show-post-attachment-file-format {
margin-right: 8px;
vertical-align: middle;
font-size: 1rem;
}
}
.group-show-post-seen-by {
float: right;
cursor: pointer;
&:hover {
.group-show-post-seen-by-names {
display: block;
white-space: nowrap;
}
}
.group-show-post-seen-by-name {
display: block;
color: #fff;
white-space: nowrap;
}
}
.group-show-post-seen-by-lead {
margin-right: 4px;
font-style: normal;
}
.group-show-post-seen-by-names {
display: none;
}
.group-show-post-seen-by-count {
border-radius: 50%;
background: $gray;
display: inline-block;
}
// Comment section
.comments {
clear: both;
.group-show-post-respond-comment {
width: 100%;
height: 60px;
padding: 0 1rem;
box-shadow: none;
width: 100%;
}
.group-show-post-avatar {
display: none;
}
}
.group-show-post-actions {
position: absolute;
right: 0;
top: 0;
}
.group-no-permission {
padding-left: 2rem;
background: $red;
color: $white;
padding: 10px 0.75rem;
border-radius: $general;
i {
margin-right: 8px;
}
}
.group-show-post-respond-wrap {
margin-bottom: 16px;
}
.group-show-post-respond-submit {
font-size: 0.875rem;
}
.group-show-post-comment-list {
margin: 0;
padding: 0;
list-style: none;
}
.group-show-post-comment {
position: relative;
border-radius: 0;
box-shadow: none;
border-bottom: 2px solid $gray;
&:hover {
box-shadow: none;
}
}
.group-show-post-comment-wrap {
overflow: hidden;
padding: 16px 1.25rem;
}
.group-show-post-no-comment {
font-size: 0.8125rem;
}
.group-show-post-comment-avatar {
float: left;
width: 60px;
margin-right: 1rem;
img {
width: 60px;
height: 60px;
border-radius: 50%;
}
}
.group-show-post-comment-author {
font-size: .9375rem;
float: left;
margin-right: 0.5rem;
}
.group-show-post-comment-time {
float: left;
}
.group-show-post-comment-content {
clear: both;
}
.group-show-post-comment-body {
float: left;
width: 60%;
}
// 260px
@media screen and (min-width: 16.25rem) {
.group-show-post-attachments {
a {
display: inline-block;
text-overflow: ellipsis;
}
}
.group-show-post-attachments-file-name {
display: inline-block;
text-overflow: ellipsis;
overflow: hidden;
vertical-align: middle;
width: 80px;
white-space: nowrap;
}
}
// 370px
@media screen and (min-width: 23.125rem) {
.group-show-post-comment-body {
width: 70%;
}
}
// 800px
@media screen and (min-width: 50rem) {
.group-show-post-comment-body {
width: 85%;
}
.comments {
.group-show-post-avatar {
float: left;
width: 10%;
max-width: 60px;
min-width: 60px;
display: block;
}
.group-show-post-respond-comment {
float: left;
width: 89%;
margin-left: 1%;
}
}
}
// 960px
@media screen and (min-width: 60rem) {
.group-show-post-comment-body {
width: 90%;
}
}

View File

@ -0,0 +1,36 @@
@charset "utf-8";
// Google fonts
@import url(http://fonts.googleapis.com/css?family=Maven+Pro);
@import url(http://fonts.googleapis.com/css?family=Roboto);
// Font stacks
$main-font: "Maven Pro", "微軟正黑體" sans-serif;
$sub-font: "Roboto", "微軟正黑體", sans-serif;
$paragraph-font: "Roboto", "微軟正黑體", sans-serif;
// Colors
$gray: #f3f3f3;
$dark-gray: #aaaaaa;
$light-gray: #cdcdcd;
$white: white;
$light-black: #353535;
$black: black;
$green: #74c25d;
$blue: #4171d5;
$red: #dd5933;
$blue-green: #00acee;
$group-page-bar-color: #171717;
// Transition units
$fast: 0.3s;
$normal: 0.6s;
$slow: 1s;
// Border radius units
$general: 0.25rem;
$round: 50%;
// Commonly use units
$boundary: 1150px;

View File

@ -0,0 +1,270 @@
@charset "utf-8";
@import "group-variables";
@import "group-classes";
@import "group-reset";
// General style
body {
background: $gray;
font-family: $main-font;
}
// dropzone
.dropzone-pool {
border: 2px dashed $blue;
margin-bottom: 16px;
font-family: $paragraph-font;
font-size: 0.9375rem;
color: $dark-gray;
margin-right: 1rem;
border-radius: $general;
}
// Override and resolve the conflict with main-form.css for that I need RWD support for this page
.main-forms fieldset .input-area .controls textarea {
max-width: none;
}
// Override Bootstrap modal
.modal.fade {
top: -65%;
}
// Override select2 styles, I need this evil power
#main-wrap {
.select2-container-multi {
margin-right: 0.9375rem;
min-width: 200px;
.select2-choices {
padding: 0;
border-radius: $general;
.select2-search-field {
input {
padding: 10px 5px;
}
}
}
.select2-search-choice {
padding: 10px 1.75rem 10px 0.7rem;
border-color: lighten($light-gray, 5%);
background: $white;
> div {
&:before {
content: "\F007";
font-family: FontAwesome;
display: inline-block;
font-size: 0.9375rem;
color: $blue;
margin: 0 0.5rem 0 0;
}
}
}
.select2-search-choice-close {
right: 15px;
left: auto;
&:before {
content: "\f057";
font-family: FontAwesome;
position: absolute;
cursor: pointer;
left: 6px;
top: 6px;
font-size: 0.9375rem;
color: $dark-gray;
}
&:hover {
&:before {
color: $red;
}
}
}
}
}
.select2-result-label {
> span {
white-space: nowrap;
}
}
.wrap-inner {
.upload-status-notice {
position: fixed;
right: 1rem;
top: 4rem;
color: $white;
padding: 16px 1.375rem;
background-color: $blue;
border-radius: $general;
font-size: 0.8125rem;
box-shadow: 0px 0px 16px 3px rgba(0, 0, 0, 0.2);
-webkit-animation-duration: .3s;
animation-duration: .3s;
z-index: 3000;
}
}
.fileupload {
.thumbnail {
max-width: 60%;
height: auto;
}
}
.img-avatar {
width: 50px;
height: 50px;
}
// members page
.existing-phone-avatar {
vertical-align: top;
margin: 0 0.5rem 0.5rem 0;
}
.existing-member-count {
width: 60px;
height: 60px;
display: inline-block;
box-sizing: border-box;
line-height: 40px;
text-align: center;
white-space: nowrap;
padding: 8px 0.45rem;
font-size: 0.8125rem;
}
.group-edit-button {
box-sizing: border-box;
vertical-align: top;
line-height: 40px;
width: 60px;
height: 60px;
display: inline-block;
text-align: center;
font-size: 0.8125rem;
}
.group-edit-avatar {
width: 60;
}
.group-member-edit-table {
width: 100%;
tr {
border-bottom: 1px solid $gray;
}
td {
padding: 8px 0.75rem;
&:first-child {
width: 60px;
}
}
.make-admin-checkbox {
display: inline-block;
vertical-align: top;
margin-right: 0.3125rem;
}
.group-member-permission {
display: inline-block;
vertical-align: text-top;
}
}
.group-admin-edit-image-wrap {
margin: 0 24px 1rem 0;
}
.group-admin-edit-image-item {
margin: 0 10px 16px 0;
padding: 16px 0.5rem;
}
.group-admin-edit-image-container {
max-width: 100px;
margin: 0 1rem 16px 0;
}
.group-admin-edit-checkbox-wrap {
color: $white;
font-size: 0.8125rem;
background: $blue;
padding: 2px 0.625rem;
border-radius: $general;
float: left;
}
.group-admin-edit-image-checkbox {
display: inline-block;
vertical-align: top;
}
.group-admin-edit-image-label {
display: inline-block;
vertical-align: text-top;
font-size: 0.75rem;
}
.group-admin-edit-image-item-inner {
padding: 16px 0.625rem;
background: $white;
border-radius: $general;
}
.group-admin-edit-file-wrap {
margin-bottom: 10px;
}
.group-admin-edit-file-item {
padding: 10px 16px;
float: left;
margin: 0 8px 0.5rem 0;
font-size: 0.8125rem;
.group-admin-edit-file-checkbox {
margin: 0;
}
}
.group-admin-edit-filename {
margin-right: 0.3125rem;
}
.group-admin-edit-file-delete {
padding-bottom: 4px;
border-bottom: 1px dotted $red;
vertical-align: top;
}
@media screen and (min-width: 700px) {
.group-admin-edit-image-item {
float: left;
width: 45%;
}
}
@media screen and (min-width: 960px) {
.group-admin-edit-image-item {
width: 30%;
}
}
@media screen and (min-width: 1150px) {
.group-admin-edit-image-item {
width: 20%;
}
}

View File

@ -0,0 +1,15 @@
@charset "utf-8";
@import "group-variables";
@import "group-classes";
@import "group-reset";
@import "group-index";
@import "group-post";
@import "group-show-post";
@import "group-category";
@import "group-members";
.topnav {
display: none;
}

View File

@ -0,0 +1,13 @@
.module-area .control-group {
display: inline-block;
width: 45%;
vertical-align: top;
}
.module-area .control-group input {
max-width: 100%;
}
.module-area .big-group {
width: 100%;
}

View File

@ -4,6 +4,7 @@
text-shadow: 0 1px 0 #ffffff; text-shadow: 0 1px 0 #ffffff;
font-family: 'Playfair Display SC', sans-serif; font-family: 'Playfair Display SC', sans-serif;
} }
.main-forms fieldset { .main-forms fieldset {
background-color: #FFFFFF; background-color: #FFFFFF;
border: 1px solid #EDEDED; border: 1px solid #EDEDED;
@ -12,9 +13,11 @@
-moz-border-radius: 5px; -moz-border-radius: 5px;
border-radius: 5px; border-radius: 5px;
} }
.main-forms fieldset .input-area { .main-forms fieldset .input-area {
padding: 20px 20px 0; padding: 20px 20px 0;
} }
.main-forms fieldset .input-area:after { .main-forms fieldset .input-area:after {
content: ""; content: "";
clear: both; clear: both;
@ -22,6 +25,7 @@
height: 0; height: 0;
visibility: hidden; visibility: hidden;
} }
.main-forms fieldset .input-area .nav-name { .main-forms fieldset .input-area .nav-name {
float: left; float: left;
width: 100px; width: 100px;
@ -33,27 +37,26 @@
font-weight: normal; font-weight: normal;
line-height: 20px; line-height: 20px;
} }
/*.main-forms fieldset .input-area .control-label {
width: 100px;
}
.main-forms fieldset .input-area .controls {
margin-left: 120px;
}*/
.main-forms fieldset .input-area .controls textarea { .main-forms fieldset .input-area .controls textarea {
max-width: 500px; max-width: 500px;
max-height: 300px; max-height: 300px;
min-height: 86px; min-height: 86px;
} }
.main-forms fieldset .input-area .controls textarea.cke_source { .main-forms fieldset .input-area .controls textarea.cke_source {
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
} }
.main-forms fieldset .input-area .controls hr { .main-forms fieldset .input-area .controls hr {
margin: 5px 0 10px; margin: 5px 0 10px;
} }
.main-forms fieldset .input-area .controls h5 { .main-forms fieldset .input-area .controls h5 {
margin: 5px 0; margin: 5px 0;
} }
.main-forms fieldset .input-area .controls .file-link { .main-forms fieldset .input-area .controls .file-link {
margin-right: 10px; margin-right: 10px;
display: inline-block; display: inline-block;
@ -62,73 +65,92 @@
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.main-forms fieldset .input-area .controls .input-prepend { .main-forms fieldset .input-area .controls .input-prepend {
margin-bottom: 5px; margin-bottom: 5px;
} }
.main-forms fieldset .input-area .controls .input-prepend .btn-group { .main-forms fieldset .input-area .controls .input-prepend .btn-group {
padding: 4px 12px; padding: 4px 12px;
} }
.main-forms fieldset .input-area .controls .input-prepend .btn-group { .main-forms fieldset .input-area .controls .input-prepend .btn-group {
padding: 4px 12px; padding: 4px 12px;
} }
.main-forms fieldset .input-area .controls .input-prepend .btn-group .radio input[type="radio"], .main-forms fieldset .input-area .controls .input-prepend .btn-group .radio input[type="radio"],
.main-forms fieldset .input-area .controls .input-prepend .btn-group .checkbox input[type="checkbox"] { .main-forms fieldset .input-area .controls .input-prepend .btn-group .checkbox input[type="checkbox"] {
margin: 5px 5px 0 0; margin: 5px 5px 0 0;
} }
.main-forms fieldset .input-area .controls .input-prepend .btn-group li { .main-forms fieldset .input-area .controls .input-prepend .btn-group li {
text-align: left; text-align: left;
padding: 3px 10px; padding: 3px 10px;
} }
.main-forms fieldset .input-area .controls .input-prepend .btn-group li label { .main-forms fieldset .input-area .controls .input-prepend .btn-group li label {
padding-left: 5px; padding-left: 5px;
display: block; display: block;
} }
.main-forms fieldset .input-area .controls .exist .input-prepend .btn-group:hover .dropdown-menu ,
.main-forms fieldset .input-area .controls .exist .input-prepend .btn-group:hover .dropdown-menu,
.main-forms fieldset .input-area .controls .add-target .input-prepend .btn-group:hover .dropdown-menu { .main-forms fieldset .input-area .controls .add-target .input-prepend .btn-group:hover .dropdown-menu {
display: block; display: block;
} }
.main-forms fieldset .input-area .controls .exist .input-prepend, .main-forms fieldset .input-area .controls .exist .input-prepend,
.main-forms fieldset .input-area .controls .add-target .input-prepend { .main-forms fieldset .input-area .controls .add-target .input-prepend {
margin-bottom: 10px; margin-bottom: 10px;
display: inline-block; display: inline-block;
} }
.main-forms fieldset .input-area .controls .exist .fileupload-new { .main-forms fieldset .input-area .controls .exist .fileupload-new {
display: block; display: block;
} }
.main-forms fieldset .input-area .controls .exist .fileupload-new .input-prepend { .main-forms fieldset .input-area .controls .exist .fileupload-new .input-prepend {
display: inline-block; display: inline-block;
} }
.main-forms fieldset .input-area .controls .input-prepend a { .main-forms fieldset .input-area .controls .input-prepend a {
text-decoration: none; text-decoration: none;
color: #333333; color: #333333;
} }
.main-forms fieldset .input-area .controls .input-prepend .tab-content > .active { .main-forms fieldset .input-area .controls .input-prepend .tab-content > .active {
display: inline-block; display: inline-block;
} }
.main-forms fieldset .input-area .controls .add-btn { .main-forms fieldset .input-area .controls .add-btn {
margin: 3px 0; margin: 3px 0;
} }
.main-forms fieldset .input-area .fileupload { .main-forms fieldset .input-area .fileupload {
margin-right: 15px; margin-right: 15px;
margin-bottom: 0; margin-bottom: 0;
} }
.main-forms fieldset .input-area .datetimepick { .main-forms fieldset .input-area .datetimepick {
margin-right: 5px; margin-right: 5px;
margin-bottom: 5px; margin-bottom: 5px;
} }
.main-forms fieldset .input-area .datetimepick .add-on { .main-forms fieldset .input-area .datetimepick .add-on {
line-height: 24px; line-height: 24px;
cursor: pointer; cursor: pointer;
} }
.main-forms fieldset .input-area .language-area .input-content .mceLayout { .main-forms fieldset .input-area .language-area .input-content .mceLayout {
width: 100%!important; width: 100%!important;
} }
.main-forms fieldset .input-area .module-nav, .main-forms fieldset .input-area .module-nav,
.main-forms fieldset .input-area .language-nav { .main-forms fieldset .input-area .language-nav {
margin: 0 0 20px; margin: 0 0 20px;
padding: 0 0 15px 120px; padding: 0 0 15px 120px;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
} }
.main-forms fieldset .input-area .module-nav li, .main-forms fieldset .input-area .module-nav li,
.main-forms fieldset .input-area .language-nav li { .main-forms fieldset .input-area .language-nav li {
position: relative; position: relative;
@ -151,23 +173,28 @@
border-color: transparent transparent #EDEDED transparent; border-color: transparent transparent #EDEDED transparent;
z-index: 5 z-index: 5
} }
.main-forms fieldset .input-area .module-nav li.active:after { .main-forms fieldset .input-area .module-nav li.active:after {
display: none; display: none;
} }
.main-forms fieldset .input-area .language-nav li.active:after { .main-forms fieldset .input-area .language-nav li.active:after {
bottom: -16px; bottom: -16px;
margin-left: -4px; margin-left: -4px;
border-width: 0 5px 5px 5px; border-width: 0 5px 5px 5px;
border-color: transparent transparent #FFFFFF transparent; border-color: transparent transparent #FFFFFF transparent;
} }
.main-forms fieldset .input-area .module-nav { .main-forms fieldset .input-area .module-nav {
margin-bottom: 0; margin-bottom: 0;
border-bottom: none; border-bottom: none;
} }
.main-forms fieldset .input-area .language-area, .main-forms fieldset .input-area .language-area,
.main-forms fieldset .input-area .module-area { .main-forms fieldset .input-area .module-area {
overflow: visible; overflow: visible;
} }
.main-forms fieldset .input-area .module-area { .main-forms fieldset .input-area .module-area {
padding-top: 20px; padding-top: 20px;
margin-bottom: 40px; margin-bottom: 40px;
@ -175,31 +202,35 @@
border-radius: 5px; border-radius: 5px;
overflow: hidden; overflow: hidden;
} }
.main-forms fieldset .form-actions { .main-forms fieldset .form-actions {
/*padding-left: 140px;*/
padding-left: 200px; padding-left: 200px;
margin: 0px; margin: 0px;
-webkit-border-radius: 0 0 4px 4px; -webkit-border-radius: 0 0 4px 4px;
-moz-border-radius: 0 0 4px 4px; -moz-border-radius: 0 0 4px 4px;
border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;
} }
.main-forms fieldset .input-area .nav-scroll { .main-forms fieldset .input-area .nav-scroll {
margin-left: 120px; margin-left: 120px;
width:800px; width: 800px;
position:relative; position: relative;
z-index:1; z-index: 1;
overflow:hidden; overflow: hidden;
} }
.main-forms fieldset .input-area .nav-scroll .scroller { .main-forms fieldset .input-area .nav-scroll .scroller {
width: 1000px; width: 1000px;
height:100%; height: 100%;
float:left; float: left;
padding:0; padding: 0;
} }
.main-forms fieldset .input-area .controls[data-toggle^="buttons-"] label { .main-forms fieldset .input-area .controls[data-toggle^="buttons-"] label {
position: relative; position: relative;
margin: 0 0 5px; margin: 0 0 5px;
} }
.main-forms fieldset .input-area .controls[data-toggle^="buttons-"] input[type="radio"], .main-forms fieldset .input-area .controls[data-toggle^="buttons-"] input[type="radio"],
.main-forms fieldset .input-area .controls[data-toggle^="buttons-"] input[type="checkbox"] { .main-forms fieldset .input-area .controls[data-toggle^="buttons-"] input[type="checkbox"] {
margin-left: 0; margin-left: 0;
@ -211,19 +242,18 @@
height: 100%; height: 100%;
display: block; display: block;
opacity: 0; opacity: 0;
filter: alpha(opacity=0);
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
} }
.main-forms fieldset .input-area .question { .main-forms fieldset .input-area .question {
margin-top: 5px; margin-top: 5px;
} }
/* User Role Forms */ /* User Role Forms */
#attributes-area.clickHere { #attributes-area.clickHere {
min-height: 150px; min-height: 150px;
position: relative; position: relative;
} }
#attributes-area.clickHere:before { #attributes-area.clickHere:before {
font-family: 'entypo'; font-family: 'entypo';
content: '\e0be'; content: '\e0be';
@ -234,20 +264,23 @@
left: 175px; left: 175px;
color: #51a351; color: #51a351;
opacity: .4; opacity: .4;
filter: alpha(opacity=40);
} }
.main-forms .input-append .tab-content { .main-forms .input-append .tab-content {
display: inline-block; display: inline-block;
overflow: inherit; overflow: inherit;
} }
.main-forms .input-append .tab-content .active { .main-forms .input-append .tab-content .active {
display: inline-block; display: inline-block;
background-color: transparent; background-color: transparent;
} }
.main-forms .input-append .active { .main-forms .input-append .active {
border-color: #c5c5c5; border-color: #c5c5c5;
border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25);
} }
.main-forms .input-append > .btn-group > .btn:first-child { .main-forms .input-append > .btn-group > .btn:first-child {
margin-left: -1px; margin-left: -1px;
-webkit-border-bottom-left-radius: 0px; -webkit-border-bottom-left-radius: 0px;
@ -257,29 +290,36 @@
-moz-border-radius-bottomleft: 0px; -moz-border-radius-bottomleft: 0px;
-moz-border-radius-topleft: 0px; -moz-border-radius-topleft: 0px;
} }
.main-forms .attributes { .main-forms .attributes {
padding-bottom: 20px; padding-bottom: 20px;
} }
.main-forms .attributes .tab-content { .main-forms .attributes .tab-content {
overflow: inherit; overflow: inherit;
} }
.main-forms .attributes.disabled label, .main-forms .attributes.disabled label,
.main-forms .attributes.disabled h4 { .main-forms .attributes.disabled h4 {
color: #e6e6e6; color: #e6e6e6;
} }
.main-forms .attributes-header { .main-forms .attributes-header {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
margin-bottom: 20px; margin-bottom: 20px;
padding-bottom: 10px; padding-bottom: 10px;
} }
.main-forms .attributes-header .btn { .main-forms .attributes-header .btn {
margin-left: 5px; margin-left: 5px;
} }
.main-forms .attributes-header h4 { .main-forms .attributes-header h4 {
font-family: 'Chivo'; font-family: 'Chivo';
line-height: 26px; line-height: 26px;
margin: 0; margin: 0;
} }
.main-forms .attributes-header h4 b { .main-forms .attributes-header h4 b {
padding: 0 1px; padding: 0 1px;
border-style: dotted; border-style: dotted;
@ -288,15 +328,18 @@
margin-right: 5px; margin-right: 5px;
cursor: move; cursor: move;
} }
.main-forms .attributes-header h4 i { .main-forms .attributes-header h4 i {
cursor: pointer; cursor: pointer;
} }
.main-forms .field-type { .main-forms .field-type {
background-color: #f5f5f5; background-color: #f5f5f5;
border-radius: 5px; border-radius: 5px;
margin-bottom: 20px; margin-bottom: 20px;
padding: 10px; padding: 10px;
} }
.main-forms .field-type.fade { .main-forms .field-type.fade {
padding: 0px 10px; padding: 0px 10px;
-webkit-transition: all 0.15s linear; -webkit-transition: all 0.15s linear;
@ -304,6 +347,7 @@
-o-transition: all 0.15s linear; -o-transition: all 0.15s linear;
transition: all 0.15s linear; transition: all 0.15s linear;
} }
.main-forms .field-type.in { .main-forms .field-type.in {
padding: 20px 10px; padding: 20px 10px;
-webkit-transition: all 0.15s linear; -webkit-transition: all 0.15s linear;
@ -311,41 +355,51 @@
-o-transition: all 0.15s linear; -o-transition: all 0.15s linear;
transition: all 0.15s linear; transition: all 0.15s linear;
} }
.main-forms .field-type .control-group { .main-forms .field-type .control-group {
margin-bottom: 20px; margin-bottom: 20px;
margin-top: 0px; margin-top: 0px;
} }
.main-forms .field-type .control-group:last-child { .main-forms .field-type .control-group:last-child {
margin-bottom: 10px; margin-bottom: 10px;
} }
#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;
} }
.main-forms .field-type .control-group .add-target .input-append:first-child { .main-forms .field-type .control-group .add-target .input-append:first-child {
margin-top: 0px; margin-top: 0px;
} }
.main-forms .field-type .control-group .add-target .input-append input + input { .main-forms .field-type .control-group .add-target .input-append input + input {
border-radius: 0; border-radius: 0;
margin-left: -1px; margin-left: -1px;
} }
.main-forms .field-type .control-group .add-target.single .input-append input.last, .main-forms .field-type .control-group .add-target.single .input-append input.last,
.main-forms .control-group .add-target .btn-group .btn.last { .main-forms .control-group .add-target .btn-group .btn.last {
border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0;
} }
.main-forms .parts-none { .main-forms .parts-none {
width: 100%; width: 100%;
text-align: center; text-align: center;
padding: 50px 0 70px; padding: 50px 0 70px;
font-size: 2em; font-size: 2em;
} }
.main-forms .display-mode .typesetting { .main-forms .display-mode .typesetting {
margin: 0 0 10px 0; margin: 0 0 10px 0;
} }
.main-forms .display-mode table td:last-child { .main-forms .display-mode table td:last-child {
text-align: right; text-align: right;
} }
.main-forms .display-mode .typesetting li { .main-forms .display-mode .typesetting li {
display: inline-block; display: inline-block;
float: left; float: left;
@ -354,13 +408,16 @@
padding: 2px; padding: 2px;
text-align: center; text-align: center;
} }
.main-forms .display-mode .typesetting li + li { .main-forms .display-mode .typesetting li + li {
margin-left: 10px; margin-left: 10px;
} }
.main-forms .display-mode .typesetting li.active { .main-forms .display-mode .typesetting li.active {
padding: 0; padding: 0;
width: 124px; width: 124px;
} }
.main-forms .display-mode .typesetting li.active:after { .main-forms .display-mode .typesetting li.active:after {
font-family: FontAwesome; font-family: FontAwesome;
content: "\f00c"; content: "\f00c";
@ -378,24 +435,26 @@
border-color: transparent #FFA307 transparent transparent; border-color: transparent #FFA307 transparent transparent;
z-index: 1; z-index: 1;
} }
.main-forms .display-mode .typesetting li.active img { .main-forms .display-mode .typesetting li.active img {
border-radius: 5px; border-radius: 5px;
background-color: #FFA307; background-color: #FFA307;
padding: 2px; padding: 2px;
} }
.main-forms .display-mode .typesetting img { .main-forms .display-mode .typesetting img {
width: 120px; width: 120px;
height: 120px; height: 120px;
} }
.main-forms .display-mode .typesetting input[type="radio"] { .main-forms .display-mode .typesetting input[type="radio"] {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0)0;
opacity: 0; opacity: 0;
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
margin: 0; margin: 0;
} }
.main-forms .display-mode .typesetting .style_description { .main-forms .display-mode .typesetting .style_description {
display: block; display: block;
line-height: 1.2em; line-height: 1.2em;
@ -412,14 +471,17 @@
display: inline-block; display: inline-block;
position: relative; position: relative;
} }
.textarea-lang .ui-wrapper { .textarea-lang .ui-wrapper {
padding-bottom: 0!important; padding-bottom: 0!important;
} }
.textarea-lang .ui-resizable-handle { .textarea-lang .ui-resizable-handle {
position: absolute; position: absolute;
font-size: 0.1px; font-size: 0.1px;
display: block; display: block;
} }
.textarea-lang .ui-resizable-se { .textarea-lang .ui-resizable-se {
cursor: se-resize; cursor: se-resize;
right: 1px; right: 1px;
@ -430,19 +492,24 @@
border-width: 0 0 8px 8px; border-width: 0 0 8px 8px;
border-color: transparent transparent #bcbcbc transparent; border-color: transparent transparent #bcbcbc transparent;
} }
.textarea-lang .tab-pane textarea { .textarea-lang .tab-pane textarea {
border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;
} }
.textarea-lang .btn-group { .textarea-lang .btn-group {
display: table; display: table;
width: 100%; width: 100%;
} }
.textarea-lang .btn-group .btn { .textarea-lang .btn-group .btn {
display: table-cell; display: table-cell;
} }
.textarea-lang .btn-group > .btn:first-child { .textarea-lang .btn-group > .btn:first-child {
border-radius: 4px 0 0 0; border-radius: 4px 0 0 0;
} }
.textarea-lang .btn-group > .btn:last-child { .textarea-lang .btn-group > .btn:last-child {
border-radius: 0 4px 0 0; border-radius: 0 4px 0 0;
} }
@ -450,23 +517,24 @@
#address-field .control-label { #address-field .control-label {
width: 120px; width: 120px;
} }
#address-field .controls { #address-field .controls {
margin-left: 140px; margin-left: 140px;
} }
#sideset ul.mobile-themes, #sideset ul.mobile-themes,
#sideset ul.orbitbar-themes { #sideset ul.orbitbar-themes {
list-style: none; list-style: none;
margin: 0; margin: 0;
} }
#sideset ul.mobile-themes:after { #sideset ul.mobile-themes:after {
content: ""; content: "";
clear: both; clear: both;
display: block; display: block;
visibility: hidden; visibility: hidden;
} }
#sideset ul.mobile-themes li, #sideset ul.mobile-themes li,
#sideset ul.orbitbar-themes li { #sideset ul.orbitbar-themes li {
position: relative; position: relative;
@ -474,29 +542,29 @@
margin-bottom: 10px; margin-bottom: 10px;
overflow: hidden; overflow: hidden;
padding: 5px; padding: 5px;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70);
opacity: .7; opacity: .7;
} }
#sideset ul.mobile-themes li { #sideset ul.mobile-themes li {
float: left; float: left;
display: inline-block; display: inline-block;
width: 160px; width: 160px;
height: 240px; height: 240px;
} }
#sideset ul.orbitbar-themes li { #sideset ul.orbitbar-themes li {
width: 500px; width: 500px;
height: 40px; height: 40px;
} }
#sideset ul.mobile-themes li.active, #sideset ul.mobile-themes li.active,
#sideset ul.orbitbar-themes li.active { #sideset ul.orbitbar-themes li.active {
border: 5px solid #0088cc; border: 5px solid #0088cc;
border-radius: 5px; border-radius: 5px;
padding: 0px; padding: 0px;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
opacity: 1; opacity: 1;
} }
#sideset ul.mobile-themes li.active:after, #sideset ul.mobile-themes li.active:after,
#sideset ul.orbitbar-themes li.active:after { #sideset ul.orbitbar-themes li.active:after {
font-family: FontAwesome; font-family: FontAwesome;
@ -515,34 +583,43 @@
border-color: transparent #0088cc transparent transparent; border-color: transparent #0088cc transparent transparent;
z-index: 1; z-index: 1;
} }
#sideset ul.mobile-themes li img { #sideset ul.mobile-themes li img {
width: 160px; width: 160px;
height: 240px; height: 240px;
} }
#sideset ul.mobile-themes li input[type="radio"], #sideset ul.mobile-themes li input[type="radio"],
#sideset ul.orbitbar-themes li input[type="radio"] { #sideset ul.orbitbar-themes li input[type="radio"] {
margin-top: 0px; margin-top: 0px;
position: absolute; position: absolute;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0; opacity: 0;
display: block; display: block;
} }
#sideset ul.mobile-themes li input[type="radio"] { #sideset ul.mobile-themes li input[type="radio"] {
width: 160px; width: 160px;
height: 240px; height: 240px;
} }
#sideset ul.orbitbar-themes li input[type="radio"] { #sideset ul.orbitbar-themes li input[type="radio"] {
width: 500px; width: 500px;
height: 40px; height: 40px;
} }
#sideset blockquote { #sideset blockquote {
margin-bottom: 30px; margin-bottom: 30px;
} }
/* Responsive */ .downloaded_times {
@media (min-width: 768px) and (max-width: 979px) { display: inline-block;
font-size: 14px;
height: 30px;
line-height: 30px;
padding-left: 10px;
vertical-align: top;
} }
/* Responsive */
@media (max-width: 480px) { @media (max-width: 480px) {
.main-forms fieldset .input-area .nav-name { .main-forms fieldset .input-area .nav-name {

View File

@ -346,12 +346,14 @@
position: relative; position: relative;
border-bottom: 5px solid #b1b1b1; border-bottom: 5px solid #b1b1b1;
height: 8px; height: 8px;
text-align: center;
} }
#profile #member-roles .roles h4 span { #profile #member-roles .roles h4 span {
position: absolute; /*position: absolute;*/
background-color: #F3F3F3; background-color: #F3F3F3;
padding: 0 5px; padding: 0 5px;
left: 50%; /*left: 50%;*/
margin: auto !important;
} }
#profile #member-roles .roles dl { #profile #member-roles .roles dl {
background-color: #ffffff; background-color: #ffffff;
@ -365,12 +367,22 @@
font-size: 1.2em; font-size: 1.2em;
margin-top: 20px; margin-top: 20px;
} }
#profile #member-roles .roles dt:first-child { #profile #member-roles .roles #google_connection {
margin-top: 0px; margin-top: 0px;
position: relative;
}
#profile #member-roles .wait_text {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
} }
#profile #member-roles .roles dd { #profile #member-roles .roles dd {
color: #999999; color: #999999;
} }
#profile #module-navbar { #profile #module-navbar {
margin-left: 10px; margin-left: 10px;
} }

View File

@ -16,6 +16,20 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
} }
} }
.login-btn {
display: inline-block;
padding: 6px 18px;
margin-bottom: 0;
font-size: 14px;
line-height: 20px;
color: #fff;
outline: none;
text-align: center;
vertical-align: middle;
cursor: pointer;
border-radius: 4px;
}
.orbitMenuLink { .orbitMenuLink {
cursor: pointer; cursor: pointer;
width: 50px; width: 50px;
@ -27,7 +41,7 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
color: #FFF; color: #FFF;
font-family: 'Chivo'; font-family: 'Chivo';
i { i {
display: block; display: inline-block;
width: 50px; width: 50px;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
@ -37,6 +51,13 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
text-align: center; text-align: center;
} }
} }
.orbit-bar-language-icon {
width: 30px;
}
.orbit-bar-language-text {
display: inline-block;
vertical-align: top;
}
} }
#orbit-bar { #orbit-bar {
position: fixed; position: fixed;
@ -45,7 +66,7 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
left: 0; left: 0;
font-family: 'Chivo'; font-family: 'Chivo';
font-size: 16px; font-size: 16px;
z-index: 999; z-index: 1040;
-webkit-box-sizing: initial; -webkit-box-sizing: initial;
-moz-box-sizing: initial; -moz-box-sizing: initial;
box-sizing: initial; box-sizing: initial;
@ -76,6 +97,7 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
&:checked { &:checked {
&~.cover { &~.cover {
display: block; display: block;
margin-bottom: 0;
} }
&~.login-window { &~.login-window {
display: block; display: block;
@ -95,29 +117,25 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
.login-window { .login-window {
display: none; display: none;
position: absolute; position: absolute;
top: 3em; top: 5em;
left: 50%; left: 50%;
width: 500px; width: 400px;
z-index: 10; z-index: 10;
background-color: #fff; background-color: #fff;
margin-left: -250px; margin-left: -200px;
border-radius: 5px; border-radius: 5px;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
.login-header { .login-header {
padding: 10px 15px; padding: 20px 40px 0 40px;
border-bottom: 1px solid lighten($orbit-bar-bgc, 60%);
.close { .close {
float: right; float: right;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
line-height: 20px; line-height: 20px;
cursor: pointer; cursor: pointer;
color: lighten($orbit-bar-bgc, 60%);
&:hover {
color: lighten($orbit-bar-bgc, 40%);
}
} }
h3 { h3 {
font-family: Chivo, "微軟正黑體", "Helvetica Neue", Helvetica, sans-serif;
color: $orbit-bar-bgc-lighter; color: $orbit-bar-bgc-lighter;
margin: 0; margin: 0;
} }
@ -131,59 +149,41 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
} }
.prepend { .prepend {
margin-bottom: 15px; margin-bottom: 15px;
text-align: left;
.add { .add {
color: #8D8D8D; color: #8D8D8D;
border-radius: 4px 0 0 4px; border-radius: 4px 0 0 4px;
margin-right: -5px; margin-right: -5px;
display: inline-block; display: inline-block;
width: auto; padding: 8px 5px;
height: 20px; font-size: 13px;
min-width: 16px; text-shadow: 0 1px 0 #fff;
padding: 4px 5px; background-color: #eee;
font-size: 14px;
font-weight: normal;
line-height: 20px;
text-align: center;
text-shadow: 0 1px 0 #ffffff;
background-color: #eeeeee;
border: 1px solid #ccc; border: 1px solid #ccc;
white-space: nowrap; vertical-align: top;
height: auto;
} }
.input { .input {
display: inline-block; font-size: 13px;
position: relative; padding: 8px 6px;
width: 270px; width: 260px;
height: 20px;
vertical-align: top;
border-radius: 0 4px 4px 0; border-radius: 0 4px 4px 0;
background-color: #ffffff; height: auto;
border: 1px solid #cccccc; border: 1px solid #ccc;
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
margin-left: 0;
padding: 4px 6px;
font-size: 14px;
line-height: 20px;
color: #555555;
white-space: nowrap;
} }
} }
.login-submit-wrap {
overflow: hidden;
margin-bottom: 10px;
}
.submit { .submit {
float: left;
margin-right: 10px;
button { button {
display: inline-block;
padding: 4px 12px;
margin-bottom: 0;
font-size: 14px;
line-height: 20px;
color: #FFF;
outline: none;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-color: #006dcc; background-color: #006dcc;
border: 1px solid #bbbbbb; border: 1px solid #bbbbbb;
border-color: #e6e6e6 #e6e6e6 #bfbfbf; border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25); border-color: rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);
border-radius: 4px;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05); box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);
&:hover { &:hover {
background-color: #0044cc; background-color: #0044cc;
@ -193,6 +193,35 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
} }
} }
} }
.google-login {
float: left;
a {
position: relative;
padding-left: 36px;
background-color: #df4a32;
border: 1px solid #bbbbbb;
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);
box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);
color: #fff;
&:hover {
color: #fff;
background-color: #d92b0e;
}
}
.fa-google-plus {
position: absolute;
left: 10px;
top: 9px;
font-size: 18px;
}
}
.login-sign-up-btn {
clear: both;
text-align: left;
font-size: 13px;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}
} }
} }
.orbit-bar-inner { .orbit-bar-inner {
@ -282,24 +311,25 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
} }
li { li {
min-width: 100px; min-width: 100px;
padding: 0 0.8em; padding: 0;
&.divider { &.divider {
height: 1px; height: 1px;
margin: 0.3em 0; margin: 0.3em 0;
background-color: lighten($orbit-bar-bgc, 60%); background-color: lighten($orbit-bar-bgc, 60%);
} }
&:hover, &.active { &:hover, &.active {
color: #fff;
background-color: #0095CF; background-color: #0095CF;
a { a {
color: #FFF; color: #FFF;
} }
} }
} }
a { a, .active {
color: $orbit-bar-bgc-lighter; color: $orbit-bar-bgc-lighter;
font-size: 0.8em; font-size: 0.8em;
display: block; display: block;
padding: 0.5em 0; padding: 0.5em 1.2em;
white-space: nowrap; white-space: nowrap;
} }
} }
@ -317,10 +347,6 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
width: auto; width: auto;
height: 85%; height: 85%;
} }
// background-position: center;
// background-repeat: no-repeat;
// background-image: url('<%= asset_path 'orbit-logo.svg' %>');
// background-image: url('<%= asset_path 'orbit-logo.png' %>')\9;
& + ul { & + ul {
left: 0; left: 0;
} }
@ -334,7 +360,7 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
display: none; display: none;
top: 0; top: 0;
margin: 0 2em; margin: 0 2em;
padding: 0.3em 0; padding: 0;
color: #FFF; color: #FFF;
font-size: 1.4em; font-size: 1.4em;
text-align: center; text-align: center;
@ -344,6 +370,9 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
a { a {
color: #FFF; color: #FFF;
} }
.page-main & {
padding: 0.3em 0;
}
} }
.orbit-bar-search-sign-language { .orbit-bar-search-sign-language {
float: right; float: right;
@ -355,6 +384,7 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
input[type="search"] { input[type="search"] {
color: $orbit-bar-bgc-lighter; color: $orbit-bar-bgc-lighter;
border: none; border: none;
margin-bottom: 0;
border-radius: 1.7em; border-radius: 1.7em;
line-height: 1.3em; line-height: 1.3em;
padding: 0.2em 0.8em; padding: 0.2em 0.8em;
@ -377,6 +407,9 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
} }
} }
} }
#language {
padding-left: 0;
}
label { label {
padding: 0; padding: 0;
margin-bottom: 0; margin-bottom: 0;
@ -384,7 +417,7 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
} }
} }
@media (max-width: 479px) { @media (max-width: 540px) {
#orbit-bar { #orbit-bar {
.login-window { .login-window {
width: 90%; width: 90%;
@ -445,6 +478,8 @@ $orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default;
} }
.orbit-bar-title { .orbit-bar-title {
display: block; display: block;
height: 40px;
line-height: 40px;
} }
ul.orbit-bar-search-sign-language { ul.orbit-bar-search-sign-language {
display: none; display: none;

View File

@ -8,63 +8,84 @@
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
} }
*[data-pp] > *[data-ps] { *[data-pp] > .editmode-ps {
padding: 3px;
height: 50px;
outline: thin dotted #EBB666;
cursor: pointer;
position: relative; position: relative;
min-height: 150px;
outline: 2px dotted #EBB666;
cursor: pointer;
} }
*[data-pp] > *[data-ps]:before { *[data-pp] > .editmode-ps:before {
content: ""; content: attr(title);
line-height: 100%; display: block;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: #a1a1a1;
opacity: 0.6;
filter: alpha(opacity=60);
}
*[data-pp] > *[data-ps]:after {
font-size: 1rem;
font-weight: 300;
content: "Edit";
text-align: center;
margin-top: -0.7rem;
position: absolute; position: absolute;
top: 50%; top: 50%;
right: 0;
left: 0;
}
*[data-pp] > *[data-ps]:hover:before {
opacity: 0.8;
filter: alpha(opacity=80);
}
*[data-pp] > *[data-ps]:hover:after {
font-weight: 400;
}
*[data-pp] > .add-ps {
text-align: center;
position: relative;
width: 100%; width: 100%;
min-height: 2rem; color: #47bab5;
line-height: 2rem; margin-top: 10px;
cursor: pointer; text-align: center;
font-size: 1.3em;
z-index: 778;
} }
*[data-pp] > .add-ps:after { *[data-pp] > .editmode-ps > a {
font-size: 1rem; display: block;
font-weight: 300;
content: "Add";
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
background-color: #e0dbcb; background-color: rgba(255, 255, 255, .5);
z-index: 777;
} }
*[data-pp] > .add-ps:hover:after { *[data-pp] > .editmode-ps > a:before {
font-weight: 400; content: "\f044";
background-color: #923132; position: absolute;
top: 50%;
left: 50%;
font-size: 3.4em;
width: 40px;
height: 40px;
margin: -30px 0 0 -20px;
display: inline-block;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
*[data-pp] > .editmode-ps:hover:before {
color: #FFF;
}
*[data-pp] > .editmode-ps:hover > a {
color: #FFF;
background-color: rgba(17, 117, 184, .8);
}
*[data-pp] > a {
position: relative;
display: block;
height: 40px;
margin: 10px 0;
border-radius: 5px;
color: #8DE2FD;
background-color: #14A1AD;
}
*[data-pp] > a:before {
content: "\f055";
position: absolute;
top: 50%;
left: 50%;
font-size: 1.5em;
width: 20px;
height: 20px;
margin: -10px 0 0 -10px;
display: inline-block;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
*[data-pp] > a:hover {
color: #FFF;
} }

View File

@ -0,0 +1,622 @@
.boxSizing {
-webkit-box-sizing: border-box; /* webkit */
-moz-box-sizing: border-box; /* firefox */
box-sizing: border-box; /* css3 */
}
.select2-container {
margin: 0;
position: relative;
display: inline-block;
zoom: 1;
*display: inline;
vertical-align: middle;
@extend .boxSizing;
.select2-choice {
display: block;
height: 26px;
padding: 0 0 0 8px;
overflow: hidden;
position: relative;
border: 1px solid #aaa;
white-space: nowrap;
line-height: 26px;
color: #444;
text-decoration: none;
border-radius: 4px;
background-clip: padding-box;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #fff;
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.5, #fff));
background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 50%);
background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 50%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#eeeeee', GradientType = 0);
background-image: linear-gradient(to top, #eee 0%, #fff 50%);
.select2-arrow {
display: inline-block;
width: 24px;
height: 100%;
position: absolute;
right: 0;
top: 0;
border-left: 1px solid #aaa;
border-radius: 0 4px 4px 0;
text-align: center;
background-clip: padding-box;
background: #ccc;
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#cccccc', GradientType = 0);
background-image: linear-gradient(to top, #ccc 0%, #eee 60%);
b {
display: inline-block;
font-family: FontAwesome;
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
// display: block;
// width: 100%;
// height: 100%;
// background: url('<%= asset_path "select2/select2.png" %>') no-repeat 0 1px;
&:before {
content: "\f078";
}
html[dir="rtl"] & {
background-position: 2px 1px;
}
}
html[dir="rtl"] & {
left: 0;
right: auto;
border-left: none;
border-right: 1px solid #aaa;
border-radius: 4px 0 0 4px;
}
}
abbr {
display: none;
width: 12px;
height: 12px;
position: absolute;
right: 24px;
top: 8px;
font-size: 1px;
text-decoration: none;
border: 0;
background: url('<%= asset_path "select2/select2.png" %>)') right top no-repeat;
cursor: pointer;
outline: 0;
&:hover {
background-position: right -11px;
cursor: pointer;
}
}
html[dir="rtl"] & {
padding: 0 8px 0 0;
}
& > .select2-chosen {
margin-right: 26px;
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
float: none;
width: auto;
html[dir="rtl"] & {
margin-left: 26px;
margin-right: 0;
}
}
}
&.select2-drop-above {
.select2-choice {
border-bottom-color: #aaa;
border-radius: 0 0 4px 4px;
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.9, #fff));
background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 90%);
background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 90%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
background-image: linear-gradient(to bottom, #eee 0%, #fff 90%);
}
}
&.select2-allowclear {
.select2-choice {
.select2-chosen {
margin-right: 42px;
}
abbr {
display: inline-block;
}
}
}
&.select2-container-disabled {
.select2-choice {
background-color: #f4f4f4;
background-image: none;
border: 1px solid #ddd;
cursor: default;
.select2-arrow {
background-color: #f4f4f4;
background-image: none;
border-left: 0;
}
abbr {
display: none;
}
}
}
}
.select2-drop-mask {
border: 0;
margin: 0;
padding: 0;
position: fixed;
left: 0;
top: 0;
min-height: 100%;
min-width: 100%;
height: auto;
width: auto;
opacity: 0;
z-index: 9998;
background-color: #fff;
filter: alpha(opacity=0);
}
.select2-drop {
width: 100%;
margin-top: -1px;
position: absolute;
z-index: 9999;
top: 100%;
background: #fff;
color: #000;
border: 1px solid #aaa;
border-top: 0;
border-radius: 0 0 4px 4px;
box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
@extend .boxSizing;
&.select2-drop-above {
margin-top: 1px;
border-top: 1px solid #aaa;
border-bottom: 0;
border-radius: 4px 4px 0 0;
box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
.select2-search {
input {
margin-top: 4px;
}
}
}
}
.select2-drop-active {
border: 1px solid #5897fb;
border-top: none;
&.select2-drop-above {
&.select2-drop-active {
border-top: 1px solid #5897fb;
}
}
}
.select2-drop-auto-width {
border-top: 1px solid #aaa;
width: auto;
.select2-search {
padding-top: 4px;
}
}
.select2-search {
display: inline-block;
width: 100%;
min-height: 26px;
margin: 0;
padding-left: 4px;
padding-right: 4px;
position: relative;
z-index: 10000;
white-space: nowrap;
@extend .boxSizing;
input {
width: 100%;
height: auto !important;
min-height: 26px;
padding: 4px 20px 4px 5px;
margin: 0;
outline: 0;
font-family: sans-serif;
font-size: 1em;
border: 1px solid #aaa;
border-radius: 0;
box-shadow: none;
background: #fff url('<%= asset_path "select2/select2.png" %>') no-repeat 100% -22px;
background: url('<%= asset_path "select2/select2.png" %>') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
background: url('<%= asset_path "select2/select2.png" %>') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
background: url('<%= asset_path "select2/select2.png" %>') no-repeat 100% -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
background: url('<%= asset_path "select2/select2.png" %>') no-repeat 100% -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
@extend .boxSizing;
html[dir="rtl"] & {
padding: 4px 5px 4px 20px;
background: #fff url('<%= asset_path "select2/select2.png" %>') no-repeat -37px -22px;
background: url('<%= asset_path "select2/select2.png" %>') no-repeat -37px -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
background: url('<%= asset_path "select2/select2.png" %>') no-repeat -37px -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
background: url('<%= asset_path "select2/select2.png" %>') no-repeat -37px -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
background: url('<%= asset_path "select2/select2.png" %>') no-repeat -37px -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
}
&.select2-active {
background: #fff url('<%= asset_path "select2/select2-spinner.gif" %>') no-repeat 100%;
background: url('<%= asset_path "select2/select2-spinner.gif" %>') no-repeat 100%, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
background: url('<%= asset_path "select2/select2-spinner.gif" %>') no-repeat 100%, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
background: url('<%= asset_path "select2/select2-spinner.gif" %>') no-repeat 100%, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
background: url('<%= asset_path "select2/select2-spinner.gif" %>') no-repeat 100%, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
}
}
}
.select2-container-active {
.select2-choice,
.select2-choices {
border: 1px solid #5897fb;
outline: none;
box-shadow: 0 0 5px rgba(0, 0, 0, .3);
}
}
.select2-dropdown-open {
.select2-choice {
border-bottom-color: transparent;
box-shadow: 0 1px 0 #fff inset;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
background-color: #eee;
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #fff), color-stop(0.5, #eee));
background-image: -webkit-linear-gradient(center bottom, #fff 0%, #eee 50%);
background-image: -moz-linear-gradient(center bottom, #fff 0%, #eee 50%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
background-image: linear-gradient(to top, #fff 0%, #eee 50%);
.select2-arrow {
background: transparent;
border-left: none;
filter: none;
b {
// background-position: -18px 1px;
&:before {
content: "\f077";
}
html[dir="rtl"] & {
background-position: -16px 1px;
}
}
html[dir="rtl"] & {
border-right: none;
}
}
}
&.select2-drop-above {
.select2-choice,
.select2-choices {
border: 1px solid #5897fb;
border-top-color: transparent;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(0.5, #eee));
background-image: -webkit-linear-gradient(center top, #fff 0%, #eee 50%);
background-image: -moz-linear-gradient(center top, #fff 0%, #eee 50%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
background-image: linear-gradient(to bottom, #fff 0%, #eee 50%);
}
}
}
.select2-hidden-accessible {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.select2-results {
max-height: 200px;
padding: 0 0 0 2px;
margin: 4px 4px 4px 0;
position: relative;
overflow-x: hidden;
overflow-y: auto;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
.select2-result-label {
padding: 4px;
margin: 0;
cursor: pointer;
min-height: 1em;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
.thumbnail {
width: 80px;
height: 80px;
margin-right: 10px;
padding: 0;
border: none;
display: inline-block;
vertical-align: top;
box-shadow: none;
}
.thumbnail-text {
display: inline-block;
width: 125px;
}
&:after {
content: '';
display: table;
clear: both;
}
}
.select2-highlighted {
background: #3875d7;
color: #fff;
em {
background: transparent;
}
ul {
background: #fff;
color: #000;
}
}
.select2-no-results,
.select2-searching,
.select2-ajax-error,
.select2-selection-limit {
background: #f4f4f4;
display: list-item;
padding-left: 5px;
}
.select2-disabled {
background: #f4f4f4;
display: list-item;
cursor: default;
&.select2-highlighted {
color: #666;
background: #f4f4f4;
display: list-item;
cursor: default;
}
}
.select2-selected {
display: none;
}
.select2-ajax-error {
background: rgba(255, 50, 50, .2);
}
ul {
&.select2-result-sub {
margin: 0;
padding-left: 0;
}
}
li {
list-style: none;
display: list-item;
background-image: none;
em {
background: #feffde;
font-style: normal;
}
&.select2-result-with-children {
& > .select2-result-label {
font-weight: bold;
}
}
}
html[dir="rtl"] & {
padding: 0 4px 0 0;
margin: 4px 0 4px 4px;
}
}
.select2-more-results {
background: #f4f4f4;
display: list-item;
&.select2-active {
background: #f4f4f4 url('<%= asset_path "select2/select2-spinner.gif" %>') no-repeat 100%;
}
}
.select2-results-dept-1 .select2-result-label { padding-left: 20px }
.select2-results-dept-2 .select2-result-label { padding-left: 40px }
.select2-results-dept-3 .select2-result-label { padding-left: 60px }
.select2-results-dept-4 .select2-result-label { padding-left: 80px }
.select2-results-dept-5 .select2-result-label { padding-left: 100px }
.select2-results-dept-6 .select2-result-label { padding-left: 110px }
.select2-results-dept-7 .select2-result-label { padding-left: 120px }
.select2-container-multi {
.select2-choices {
height: auto !important;
height: 1%;
min-height: 26px;
margin: 0;
padding: 0 5px 0 0;
position: relative;
border: 1px solid #aaa;
cursor: text;
overflow: hidden;
background-color: #fff;
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eee), color-stop(15%, #fff));
background-image: -webkit-linear-gradient(top, #eee 1%, #fff 15%);
background-image: -moz-linear-gradient(top, #eee 1%, #fff 15%);
background-image: linear-gradient(to bottom, #eee 1%, #fff 15%);
.select2-search-field {
margin: 0;
padding: 0;
white-space: nowrap;
input {
padding: 5px;
margin: 1px 0;
font-family: sans-serif;
font-size: 100%;
color: #666;
outline: 0;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
background: transparent !important;
&.select2-active {
background: #fff url('<%= asset_path "select2/select2-spinner.gif" %>') no-repeat 100% !important;
}
}
}
.select2-search-choice {
padding: 3px 5px 3px 18px;
margin: 3px 0 3px 5px;
position: relative;
line-height: 13px;
color: #333;
cursor: default;
border: 1px solid #aaaaaa;
border-radius: 3px;
-webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
background-clip: padding-box;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #e4e4e4;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0);
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee));
background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
background-image: linear-gradient(to top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
.select2-search-choice-close {
&:hover {
background-position: right -11px;
}
}
.select2-chosen {
cursor: default;
}
html[dir="rtl"] & {
margin: 3px 5px 3px 0;
padding: 3px 18px 3px 5px;
}
}
.select2-search-choice-focus {
background: #d4d4d4;
.select2-search-choice-close {
background-position: right -11px;
}
}
html[dir="rtl"] & {
padding: 0 0 0 5px;
}
li {
float: left;
list-style: none;
html[dir="rtl"] & {
float: right;
}
}
}
.select2-search-choice-close {
left: 3px;
html[dir="rtl"] & {
left: auto;
right: 2px;
}
}
&.select2-container-active {
.select2-choices {
border: 1px solid #5897fb;
outline: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
box-shadow: 0 0 5px rgba(0, 0, 0, .3);
}
}
&.select2-container-disabled {
.select2-choices {
background-color: #f4f4f4;
background-image: none;
border: 1px solid #ddd;
cursor: default;
.select2-search-choice {
padding: 3px 5px 3px 5px;
border: 1px solid #ddd;
background-image: none;
background-color: #f4f4f4;
.select2-search-choice-close {
display: none;
background: none;
}
}
}
}
}
.select2-locked {
padding: 3px 5px 3px 5px !important;
}
.select2-default {
color: #999 !important;
}
.select2-search-choice-close {
display: block;
width: 12px;
height: 13px;
position: absolute;
right: 3px;
top: 4px;
font-size: 1px;
outline: none;
// background: url('<%= asset_path "select2/select2.png" %>') right top no-repeat;
html[dir="rtl"] & {
right: auto;
left: 3px;
}
}
.select2-match {
.select2-result-selectable &,
.select2-result-unselectable & {
text-decoration: underline;
}
}
.select2-offscreen, .select2-offscreen:focus {
clip: rect(0 0 0 0) !important;
width: 1px !important;
height: 1px !important;
border: 0 !important;
margin: 0 !important;
padding: 0 !important;
overflow: hidden !important;
position: absolute !important;
outline: 0 !important;
left: 0px !important;
top: 0px !important;
}
.select2-display-none {
display: none;
}
.select2-measure-scrollbar {
position: absolute;
top: -10000px;
left: -10000px;
width: 100px;
height: 100px;
overflow: scroll;
}

View File

@ -0,0 +1,13 @@
.sitemap-list {
padding-left: 1em;
li {
line-height: 1.5;
margin-bottom: 0.8em;
}
}
.sitemap-list.level-2,
.sitemap-list.level-3 {
margin: 12px 0;
padding-left: 2em;
}

View File

@ -4,3 +4,58 @@
*= require lib/pageslide *= require lib/pageslide
*= require lib/wrap-nav *= require lib/wrap-nav
*/ */
.ui-helper-hidden-accessible{
display: none;
}
#form_for_attribs {
margin-bottom: 5px;
}
.current-roles {
list-style: none;
margin: 0 0 20px 0;
padding: 0;
}
.current-roles > li {
padding: 8px 10px;
margin-bottom: 8px;
border-radius: 4px;
border: 1px solid #eee;
background: #fff;
-webkit-box-shadow: 0 0 2px 0 rgba(0,0,0,.2);
box-shadow: 0 0 2px 0 rgba(0,0,0,.2);
cursor: move;
}
.role-value {
display: inline-block;
margin-right: 8px;
}
.remove-role {
cursor: pointer;
float: right;
padding-left: 16px;
border-left: 2px solid #e6e6e6;
}
.remove-role > i {
font-size: 1.125rem;
}
.remove-role:hover {
color: #ff4444;
}
.attr.control-label {
text-align: left;
width: 120px;
}
.attr.controls {
margin-left: 100px;
}
.link-to-show {
float: right;
margin-right: 16px;
}
.preloader-wrap {
text-align: center;
}

View File

@ -5,28 +5,12 @@ class Admin::AuthorizationsController < OrbitAdminController
def index def index
@module_apps ||= ModuleApp.any_of({authorizable: true}).order_by([:title, :asc]) @module_apps ||= ModuleApp.any_of({authorizable: true}).order_by([:title, :asc])
if @module_apps && @module_apps.include?(@module_app) if @module_apps && @module_apps.include?(@module_app)
if @type reload_users
case @type
when 'category_authorization'
if (@module_app.categorizable || @module_app.categories.present?) if (@module_app.categorizable || @module_app.categories.present?)
@objects = @module_app.categories rescue nil @objects = @module_app.categories.order_by(:disable.asc) rescue nil
else
@error = t(:no_category)
end end
else elsif @module_apps && @module_app.key == "authorization"
@objects = @klass.all redirect_to admin_authorizations_path(@module_apps.first.key)
end
unless @objects.blank?
@object ||= @objects.first
@authorizations = Authorization.category_sub_managers(@object) rescue nil
else
@error = t(:no_data)
end
else
@authorizations = @module_app.module_managers rescue []
end
elsif @module_apps
@module_app = @module_apps.first
else else
redirect_to :root redirect_to :root
end end
@ -35,119 +19,143 @@ class Admin::AuthorizationsController < OrbitAdminController
def add_users def add_users
users = User.find(params[:user_ids]) rescue nil users = User.find(params[:user_ids]) rescue nil
unless users.nil? unless users.nil?
authorization = users.map {|u| get_or_create_authorization(u.id)}.first authorization = users.map {|u| get_or_create_authorization(u)}.first
end end
@users = @module_app.module_managers reload_users
render 'admin/authorizations/reload_users' render 'admin/authorizations/reload_users'
end end
def add_roles def add_roles
roles = Role.find(params[:role_ids]) rescue nil roles = Role.find(params[:role_ids]) rescue nil
unless roles.nil? unless roles.nil?
authorization = roles.map { |r| get_or_create_authorization_with_role(r.id)}.first authorization = roles.map { |r| get_or_create_authorization_with_role(r)}.first
end end
@users = @module_app.module_managers reload_users
render 'admin/authorizations/reload_users' render 'admin/authorizations/reload_users'
end end
def modal_select def modal_select
existing_users = User.find(params[:ids]) rescue []
roles = Role.all roles = Role.all
if @type @authorization_type = params[:authorization_type]
@object_id = @object.id if @object if @authorization_type == "sub_managers"
@object = Category.find(params[:category_id])
@sub_mangers = Authorization.category_sub_managers(@object) @sub_mangers = Authorization.category_sub_managers(@object)
@sorted_users = roles.inject({}) do |users, role| @sorted_users = roles.inject({}) do |users, role|
users_for_role = role.member_profiles.select {|m| !m.user.is_admin?}.map {|u| u.user} users_for_role = role.member_profiles.select {|m| !m.user.is_admin? if m.user}.map {|u| u.user}
users[role] = users_for_role - @sub_mangers users[role] = users_for_role - @sub_mangers
users users
end end
else else
@sorted_users = roles.inject({}) do |users, role| @sorted_users = roles.inject({}) do |users, role|
users_for_role = role.member_profiles.select {|m| !m.user.is_admin?}.map {|u| u.user} users_for_role = role.member_profiles.select {|m| !m.user.is_admin? if m.user}.map {|u| u.user}
users[role] = users_for_role - @module_app.module_managers users[role] = users_for_role - @module_app.module_managers
users users
end end
end end
end render :layout => false
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 end
def remove_users def remove_users
@users = User.find(params[:ids]) rescue [] @users = User.find(params[:user_ids]) rescue []
unless @users.blank? unless @users.blank?
authorization = @users.map {|u| remove_authorizations(u.id)}.first authorization = @users.map {|u| remove_authorizations(u)}.first
end end
@users = @module_app.module_managers roles = Role.find(params[:role_ids]) rescue []
unless roles.blank?
roles.each{|r| remove_authorizations_with_role(r)}
end
reload_users
render 'admin/authorizations/reload_users' render 'admin/authorizations/reload_users'
end end
protected protected
def get_or_create_authorization(user_id) def get_or_create_authorization(user)
case @type case params[:authorization_type]
when 'category_authorization' when "sub_managers"
if @object remove_from_manager(user) if user.is_manager?(@module_app)
Authorization.create_category_authorization(@module_app.id, @object.id, user_id) @object = Category.find(params[:category_id])
else Authorization.create_category_authorization(@module_app.id, @object.id, user.id)
@error = t(:no_data) when "managers"
end remove_from_sub_manager(user) if user.is_sub_manager?(@module_app)
when nil Authorization.create_module_authorization(@module_app.id, user.id)
Authorization.create_module_authorization(@module_app.id, user_id)
else
auth = @object.get_authorization_by_title("#{@type}_#{@module_app.key}")
unless auth
auth = Authorization.create_category_authorization(@module_app.id, @object.id, user_id) if @type.include?('authorization')
end
auth
end end
end end
def get_or_create_authorization_with_role(role_id) def remove_authorizations(user)
case @type case params[:authorization_type]
when 'category_authorization' when "sub_managers"
if @object if params[:category_id] == "all"
Authorization.create_category_authorization_with_role(@module_app.id, @object.id, role_id) remove_from_sub_manager(user)
else else
@error = t(:no_data) @object = Category.find(params[:category_id])
Authorization.remove_category_authorization(@object.id, user.id)
end end
when nil when "managers"
Authorization.create_module_authorization_with_role(@module_app.id,role_id) Authorization.remove_module_authorization(@module_app.id, user.id)
else
auth = @object.get_authorization_by_title("#{@type}_#{@module_app.key}")
unless auth
auth = Authorization.create_category_authorization_with_role(@module_app.id, @object.id, role_id)
end
auth
end end
end end
def remove_authorizations(user_id) def remove_authorizations_with_role(role)
case @type case params[:authorization_type]
when 'category_authorization' when "sub_managers"
if @object if params[:category_id] == "all"
Authorization.remove_category_authorization(@object.id, user_id) remove_from_sub_manager_with_role(role)
@error = t(:no_data)
end
when nil
Authorization.remove_module_authorization(@module_app.id, user_id)
else else
auth = @object.get_authorization_by_title("#{@type}_#{@module_app.key}") @object = Category.find(params[:category_id])
unless auth Authorization.remove_category_authorization_with_role(@object.id, role.id)
auth = Authorization.remove_category_authorization(@object.id, user_id)
end end
auth when "managers"
Authorization.remove_module_authorization_with_role(@module_app.id, role.id)
end end
end end
def remove_from_sub_manager(user)
categories = @module_app.categories.authorized(user)
categories.each do |c|
Authorization.remove_category_authorization(c.id, user.id)
end
end
def remove_from_sub_manager_with_role(role)
categories = role.approved_categories_for_module(@module_app)
categories.each do |c|
Authorization.remove_category_authorization_with_role(c.id, role.id)
end
end
def remove_from_manager(user)
Authorization.remove_module_authorization(@module_app.id, user.id)
end
def remove_from_manager_with_role(role)
Authorization.remove_module_authorization_with_role(@module_app.id, role.id)
end
def get_or_create_authorization_with_role(role)
case params[:authorization_type]
when "sub_managers"
remove_from_manager_with_role(role) if role.is_manager_for?(@module_app)
@object = Category.find(params[:category_id])
Authorization.create_category_authorization_with_role(@module_app.id, @object.id, role.id)
when "managers"
remove_from_sub_manager_with_role(role) if role.is_sub_manager_for?(@module_app)
Authorization.create_module_authorization_with_role(@module_app.id,role.id)
end
end
def reload_users
@managers = @module_app.managers rescue []
@sub_managers = @module_app.sub_managers rescue []
manager_roles = @module_app.role_managers.collect{|r| Role.find(r)} rescue []
sub_manager_roles = @module_app.role_sub_managers rescue []
@managers = @managers.concat(manager_roles)
@sub_managers = @sub_managers.concat(sub_manager_roles)
end
private private
def admin_or_manager def admin_or_manager
@ -159,10 +167,5 @@ class Admin::AuthorizationsController < OrbitAdminController
def setup_vars def setup_vars
@module_app = ModuleApp.find_by(key: params[:module]) if params[:module] @module_app = ModuleApp.find_by(key: params[:module]) if params[:module]
@type = params[:type].underscore if params[:type]
if @type
@klass = @type.gsub('_authorization', '').gsub('_approval', '').classify.constantize rescue nil
@object = @klass.find(params[:id]) rescue nil
end
end end
end end

View File

@ -2,6 +2,7 @@ class Admin::CategoriesController < OrbitAdminController
before_action :setup_vars before_action :setup_vars
def index def index
@category = Category.new
unless @module_app.nil? unless @module_app.nil?
@categories = @module_app.categories @categories = @module_app.categories
end end

View File

@ -4,31 +4,11 @@ class Admin::DashboardsController < ApplicationController
layout "basic_back_end" layout "basic_back_end"
def index def index
apps = ['bulletin', 'page', 'web_link'] apps = ['bulletin', 'page_context', 'web_link']
@module_app_contents, @module_app_contents_total = get_module_app_count(apps) @module_app_contents, @module_app_contents_total = get_module_app_count(apps)
@recent_updated = get_recently_updated(apps) @recent_updated = get_recently_updated(apps)
@most_visited = get_most_visited(apps) @most_visited = get_most_visited(apps)
end render_401 and return if !current_user.is_approved? rescue false
def reload_all_content
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link')
respond_to do |format|
format.js { render 'reload', locals: {div_id: 'all_content'} }
end
end
def reload_most_visited
@most_visited = get_most_visited('bulletin', 'page_context','page')
respond_to do |format|
format.js { render 'reload', locals: {div_id: 'most_visited'} }
end
end
def reload_recent_update
@recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link')
respond_to do |format|
format.js { render 'reload', locals: {div_id: 'recent_update'} }
end
end end
def get_cpu_usage def get_cpu_usage
@ -51,23 +31,27 @@ class Admin::DashboardsController < ApplicationController
a = {} a = {}
total = 0 total = 0
args.each do |module_app| args.each do |module_app|
module_app_class = module_app.classify.constantize module_app_class = module_app.classify.constantize rescue nil
if !module_app_class.nil?
count = module_app_class.count count = module_app_class.count
a.merge!(module_app => count) a.merge!(module_app => count)
total += count total += count
end end
end
[Kaminari.paginate_array(a.sort {|a,b| b[1]<=>a[1]}).page(params[:page]).per(5), total] [Kaminari.paginate_array(a.sort {|a,b| b[1]<=>a[1]}).page(params[:page]).per(5), total]
end end
def get_recently_updated(args) def get_recently_updated(args)
a = {} a = {}
args.each do |module_app| args.each do |module_app|
module_app_class = module_app.classify.constantize module_app_class = module_app.classify.constantize rescue nil
if !module_app_class.nil?
objects = module_app_class.order_by([:updated_at, :desc]).limit(20) objects = module_app_class.order_by([:updated_at, :desc]).limit(20)
objects.each do |object| objects.each do |object|
a.merge!(object => object.updated_at) unless (object.archived rescue nil) a.merge!(object => object.updated_at) unless (object.archived rescue nil)
end end
end end
end
sorted_objects = a.sort {|a,b| b[1]<=>a[1]} sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
sorted_objects[0..19] sorted_objects[0..19]
Kaminari.paginate_array(sorted_objects).page(params[:page]).per(5) Kaminari.paginate_array(sorted_objects).page(params[:page]).per(5)
@ -76,17 +60,18 @@ class Admin::DashboardsController < ApplicationController
def get_most_visited(args) def get_most_visited(args)
a = {} a = {}
args.each do |module_app| args.each do |module_app|
module_app_class = module_app.classify.constantize module_app_class = module_app.classify.constantize rescue nil
if !module_app_class.nil?
objects = module_app_class.order_by([:view_count, :desc]).limit(20) objects = module_app_class.order_by([:view_count, :desc]).limit(20)
objects.each do |object| objects.each do |object|
a.merge!(object => object.view_count) if object.view_count > 0 && (!object.archived rescue true) a.merge!(object => object.view_count) if object.view_count > 0 && (!object.archived rescue true)
end end
end end
end
sorted_objects = a.sort {|a,b| b[1]<=>a[1]} sorted_objects = a.sort {|a,b| b[1]<=>a[1]}
sorted_objects[0..19] sorted_objects[0..19]
Kaminari.paginate_array(sorted_objects).page(params[:page]).per(5) Kaminari.paginate_array(sorted_objects).page(params[:page]).per(5)
end end
private private
def check_backend_openness def check_backend_openness

View File

@ -5,13 +5,17 @@ class Admin::DesignsController < OrbitAdminController
@designs = [] @designs = []
Dir.glob("#{Rails.root}/app/templates/*").each do |template| Dir.glob("#{Rails.root}/app/templates/*").each do |template|
if template.split('/').last != "mobile" if template.split('/').last != "mobile"
f = File.join("#{template}/template.json")
if File.exists?f
hash = JSON.parse(File.read(f)) rescue {}
@designs << { @designs << {
"key"=>template.split('/').last, "key"=>hash["key"],
"title"=>template.split('/').last.titleize, "title"=>hash["title"],
"author"=>"Ray" "author"=>hash["author"]
} }
end end
end end
end
end end
end end

View File

@ -0,0 +1,359 @@
class Admin::GroupsController < OrbitGroupController
include Admin::GroupsHelper
def index
@groups = current_user.groups
end
def public_groups
@groups = Group.open
end
def categories
old_categories = GroupCategory.where(:is_accepted.ne => false)
if old_categories.count > 0
old_categories.each do |oc|
oc.is_accepted = true
oc.save
end
end
@admin_categories = GroupCategory.by_admin
@requested_categories = GroupCategory.is_requested
end
def newpost
render_401 and return if !user_can_write?
@no_breadcrumb = true
@grouppost = GroupPost.new
end
def createpost
gp = GroupPost.new(post_params)
gp.group = @group
gp.save
redirect_to admin_group_path(@group)
end
def updatepost
@post = GroupPost.find(params[:id])
group = @post.group
@post.update_attributes(post_update_params)
@post.save
redirect_to admin_group_path(group)
end
def deletepost
gp = GroupPost.find(params[:id])
gp.destroy
render :json => {"success" => true}.to_json
end
def showpost
render_401 and return if !user_can_read?
if (current_user.id.to_s != @post.author.to_s) && (!@post.read_by.include?(current_user.id.to_s))
@post.read_by << current_user.id.to_s
@post.save
end
@read_by_names = @post.read_by.collect{|rb|
user = User.find(rb) rescue nil
author = (user.member_profile.name == nil ? user.user_name : user.member_profile.name rescue "") if !user.nil?
author
}
end
def editpost
render_401 and return if @post.author != current_user.id
@no_breadcrumb = true
@grouppost = @post
end
def show
@no_breadcrumb = true
@no_filter = true
if !user_can_read?
render_401 and return
end
end
def members
render_401 and return if !user_can_read?
@group_members = []
@group.users.each do |user|
mp = user.member_profile rescue nil
if !mp.nil?
avatar = (mp.avatar.thumb.url == "thumb_person.png" ? "/assets/thumb_person.png" : mp.avatar.thumb.url rescue "/assets/thumb_person.png")
@group_members << {
"id" => user.id.to_s,
"user_name" => (user.user_name rescue ""),
"avatar" => avatar,
"name" => (mp.name_translations rescue {"en" => "","zh_tw" => ""}),
"admin" => @group.admins.include?(user.id.to_s)
}
end
end
end
def create_category
gc = GroupCategory.new(category_params)
gc.save
if !current_user.is_admin?
@requested_categories = GroupCategory.is_requested
render :partial => "group_requested_categories"
else
@admin_categories = GroupCategory.by_admin
render :partial => "group_categories"
end
end
def update_category
gc = GroupCategory.find(params[:category_id])
gc.update_attributes(category_params)
gc.save
@admin_categories = GroupCategory.by_admin
render :partial => "group_categories"
end
def upload_photo
photo = GroupPostImage.new(post_image_params)
photo.save
render :json => {"success" => true,"id" => photo.id.to_s}.to_json
end
def upload_file
file = GroupPostFile.new(post_file_params)
file.save
render :json => {"success" => true,"id" => file.id.to_s}.to_json
end
def download_file
file_id = params[:id]
file = GroupPostFile.find(file_id) rescue nil
if !file.nil?
redirect_to file.file.url and return
end
render :nothing => true
end
def create
group = Group.new(group_params)
group.save
redirect_to admin_groups_path
end
def update
@group = Group.find(params[:id])
@group.update_attributes(group_update_params)
@group.save
redirect_to admin_groups_path
end
def destroy
group = Group.find(params[:id])
group.destroy
render :json => {"success" => true}.to_json
end
def new
@group = Group.new
@no_breadcrumb = true
@categories = GroupCategory.by_admin.collect{|gc| [gc.title,gc.id]}
@members = []
MemberProfile.all.each do |mp|
user = mp.user rescue nil
if !user.nil? && user.id.to_s != current_user.id.to_s && user.user_name != "rulingcom"
avatar = (mp.avatar.thumb.url == "thumb_person.png" ? "/assets/thumb_person.png" : mp.avatar.thumb.url rescue "/assets/thumb_person.png")
@members << {
"id" => user.id.to_s,
"user_name" => (user.user_name rescue ""),
"avatar" => avatar,
"name" => (mp.name_translations rescue {"en" => "","zh_tw" => ""})
}
end
end
end
def edit
render_401 and return if !is_user_group_admin?
@no_breadcrumb = true
@members = []
MemberProfile.all.each do |mp|
user = mp.user rescue nil
if !user.nil? && user.id.to_s != current_user.id.to_s && user.user_name != "rulingcom" && !@group.users.include?(user)
avatar = (mp.avatar.thumb.url == "thumb_person.png" ? "/assets/thumb_person.png" : mp.avatar.thumb.url rescue "/assets/thumb_person.png")
@members << {
"id" => user.id.to_s,
"user_name" => (user.user_name rescue ""),
"avatar" => avatar,
"name" => (mp.name_translations rescue {"en" => "","zh_tw" => ""})
}
end
end
@existing_members = []
@group.users.each do |user|
mp = user.member_profile rescue nil
if !mp.nil?
avatar = (mp.avatar.thumb.url == "thumb_person.png" ? "/assets/thumb_person.png" : mp.avatar.thumb.url rescue "/assets/thumb_person.png")
@existing_members << {
"id" => user.id.to_s,
"user_name" => (user.user_name rescue ""),
"avatar" => avatar,
"name" => (mp.name_translations rescue {"en" => "","zh_tw" => ""}),
"admin" => @group.admins.include?(user.id.to_s)
}
end
end
end
def get_existing_member_template
g = params[:group_id]
group = Group.find(g)
@existing_members = []
group.users.each do |user|
mp = user.member_profile rescue nil
if !mp.nil?
avatar = (mp.avatar.thumb.url == "thumb_person.png" ? "/assets/thumb_person.png" : mp.avatar.thumb.url rescue "/assets/thumb_person.png")
@existing_members << {
"id" => user.id.to_s,
"user_name" => (user.user_name rescue ""),
"avatar" => avatar,
"name" => (mp.name_translations rescue {"en" => "","zh_tw" => ""}),
"admin" => group.admins.include?(user.id.to_s)
}
end
end
render :partial => "group_existing_member"
end
def remove_user
group = Group.find(params[:group_id])
user_id = params[:user_id]
user = User.find(user_id)
group.users.delete(user)
group.admins.delete(user.id.to_s) if group.admins.include?(user.id.to_s)
group.save
render :json => {"success" => true}.to_json
end
def toggle_admin
group = Group.find(params[:group_id])
user_id = params[:user_id]
user = User.find(user_id)
if params[:admin] == "true"
group.admins << user.id.to_s
else
group.admins.delete(user.id.to_s)
end
group.save
render :json => {"success" => true}.to_json
end
def new_comment
gpc = GroupPostComment.new(comment_params)
gpc.save
render :partial => "post_comment", :collection => [gpc]
end
private
def category_params
p = params.require(:category).permit!
if p[:is_accepted].nil?
p[:is_accepted] = true
else
p[:is_accepted] = false
end
p
end
def comment_params
params.require(:group_post_comment).permit!
end
def post_params
p = params.require(:group_post).permit!
p["author"] = current_user.id
images = []
p[:group_post_images].each do |id|
gpi = GroupPostImage.find(id) rescue nil
if !gpi.nil?
images << gpi
end
end if !p[:group_post_images].nil?
files = []
p[:group_post_files].each do |id|
gpf = GroupPostFile.find(id) rescue nil
if !gpf.nil?
files << gpf
end
end if !p[:group_post_files].nil?
p[:group_post_images] = images
p[:group_post_files] = files
p
end
def post_update_params
p = params.require(:group_post).permit!
p["author"] = current_user.id
params[:images_to_destroy].each do |img|
gpi = GroupPostImage.find(img) rescue nil
gpi.destroy if !gpi.nil?
end if !params[:images_to_destroy].nil?
images = @post.group_post_images
p[:group_post_images].each do |id|
gpi = GroupPostImage.find(id) rescue nil
if !gpi.nil?
images << gpi
end
end if !p[:group_post_images].nil?
params[:files_to_destroy].each do |fil|
gpf = GroupPostFile.find(fil) rescue nil
gpf.destroy if !gpf.nil?
end if !params[:files_to_destroy].nil?
files = @post.group_post_files
p[:group_post_files].each do |id|
gpf = GroupPostFile.find(id) rescue nil
if !gpf.nil?
files << gpf
end
end if !p[:group_post_files].nil?
p[:group_post_images] = images
p[:group_post_files] = files
p
end
def post_image_params
params.require(:group_post_image).permit!
end
def post_file_params
params.require(:group_post_file).permit!
end
def group_params
p = params.require(:group).permit!
p["user_ids"] = [] if p["user_ids"].nil?
p["user_ids"] << current_user.id.to_s
p["admins"] = []
p["admins"] << current_user.id.to_s
p
end
def group_update_params
p = params.require(:group).permit!
p["user_ids"] = [] if p["user_ids"].nil?
p["user_ids"].concat(@group.users.collect{|u| u.id.to_s})
p
end
end

File diff suppressed because it is too large Load Diff

View File

@ -4,5 +4,7 @@ class Admin::ItemsController < OrbitAdminController
layout "structure" layout "structure"
def index def index
@items = Page.all @items = Page.all
@parent_pages = []
end end
end end

View File

@ -4,9 +4,14 @@ class Admin::MembersController < OrbitMemberController
helper MemberHelper helper MemberHelper
helper OrbitBackendHelper helper OrbitBackendHelper
require 'spreadsheet'
require 'rubyXL'
def index def index
@roles = Role.excludes(disabled: true) @roles = Role.excludes(disabled: true)
page_num = params[:page] || 1 page_num = params[:page] || 1
param_temp = request.fullpath.split("?")
@edit_params = (param_temp.count > 1 ? "?" + param_temp.last : "") rescue ""
@filter = params[:filter] @filter = params[:filter]
@mq = params[:mq] @mq = params[:mq]
@ -26,17 +31,19 @@ class Admin::MembersController < OrbitMemberController
@filter = {@new_filter[:type] => [@new_filter[:id].to_s]} @filter = {@new_filter[:type] => [@new_filter[:id].to_s]}
end end
render_401 and return if current_user.nil? || !current_user.is_approved?
if @filter.blank? and @mq.blank? if @filter.blank? and @mq.blank?
render case params[:at] render case params[:at]
when 'summary' when 'summary'
@members=MemberProfile.all.page(page_num).per(12).desc("_id") @members = MemberProfile.all.page(page_num).per(12).desc("_id")
"index_summary" "index_summary"
when 'thumbnail' when 'thumbnail'
@members=MemberProfile.all.page(page_num).per(36).desc("_id") @members = MemberProfile.all.page(page_num).per(36).desc("_id")
"index_thumbnail" "index_thumbnail"
else else
@members=MemberProfile.all.page(page_num).per(10).desc("_id") @members = MemberProfile.all.page(page_num).per(10).desc("_id")
"index" "index"
end end
@ -73,7 +80,7 @@ class Admin::MembersController < OrbitMemberController
end end
def show def show
@custom_fields = @member.member_profile_field_values rescue nil @custom_fields = @member.member_profile_field_values rescue []
@plugins = OrbitApp::Plugin::Registration.all rescue nil @plugins = OrbitApp::Plugin::Registration.all rescue nil
@ppname = Array.new @ppname = Array.new
@plugins.each do |aa| @plugins.each do |aa|
@ -89,16 +96,364 @@ class Admin::MembersController < OrbitMemberController
end end
get_info_and_roles get_info_and_roles
render_401 and return if current_user.nil? || (@member.id.to_s != current_user.member_profile.id.to_s && !current_user.is_approved?)
end
def make_alpha_from_numbers(number)
@numeric = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if number < @numeric.size
@a = @numeric[number]
else
@dev_by = (number/@numeric.size).floor
@a = "#{make_alpha_from_numbers(@dev_by-1)}#{make_alpha_from_numbers(number-(@dev_by*@numeric.size))}";
end
end
def import_data_check(file)
profile_data_row = ["email","sid","office_tel","sex","birthday"]
profile_lang_data_row = ["first_name","last_name","address","autobiography"]
@field_type = {'text_field' => 'typeA', 'select' => 'typeB', 'date' => 'typeC', 'text_area' => 'typeD', 'radio_button' => 'typeE', 'checkbox' => 'typeE', 'address' => ''}
@date_type = {'format1' => '%Y/%m/%d %H:%M', 'format2' => '%Y/%m/%d', 'format3' => '%Y/%m', 'format4' => '%Y'}
@error_msg = Array.new
workbook = RubyXL::Parser.parse(file.tempfile)
sheet = workbook['Member'].extract_data
sheet.each_with_index do |row,index|
if index == 0
@field_data = row
end
if index > 2
@user_id = row[@field_data.index('user_id')]
if !@user_id.blank?
check_id = User.where(:user_name => @user_id).first
@error_msg << "#{make_alpha_from_numbers(@field_data.index('user_id'))}#{index+1}欄位帳號已存在。" if !check_id.blank?
@error_msg << "#{make_alpha_from_numbers(@field_data.index('user_id'))}#{index+1}欄位格式不符。" if @user_id.size < 3
end
@password = row[@field_data.index('password')]
if !@password.blank? and !@user_id.blank?
@error_msg << "#{make_alpha_from_numbers(@field_data.index('password'))}#{index+1}欄位格式不符。" if @password.size < 8
elsif @password.blank? and !@user_id.blank?
@error_msg << "#{make_alpha_from_numbers(@field_data.index('password'))}#{index+1}欄位格式不符。"
end
@error_msg << "#{make_alpha_from_numbers(@field_data.index('birthday'))}#{index+1}欄位日期格式不符。" if row[@field_data.index("birthday")].class.to_s != 'DateTime' and !row[@field_data.index('birthday')].blank?
@infos = MemberInfo.all
@infos.each do |info|
info.member_profile_fields.each do |member_profile_field|
if member_profile_field.markup == 'select' or member_profile_field.markup == 'radio_button'
@option_list = member_profile_field[@field_type[member_profile_field.markup]]['option_list'].collect{|p| p[0]}
@rowname = "#{info.key}-#{member_profile_field.key}"
@error_msg << "#{make_alpha_from_numbers(@field_data.index(@rowname))}#{index+1}欄位格式不符。" if !@option_list.include?("#{row[@field_data.index(@rowname)]}") and !row[@field_data.index(@rowname)].blank?
elsif member_profile_field.markup == 'checkbox'
@rowname = "#{info.key}-#{member_profile_field.key}"
@error_msg << "#{make_alpha_from_numbers(@field_data.index(@rowname))}#{index+1}欄位格式不符。" if row[@field_data.index(@rowname)].to_s.split(',').last == row[@field_data.index(@rowname)] and !row[@field_data.index(@rowname)].blank?
elsif member_profile_field.markup == 'date'
@rowname = "#{info.key}-#{member_profile_field.key}"
@error_msg << "#{make_alpha_from_numbers(@field_data.index(@rowname))}#{index+1}欄位日期格式不符。" if row[@field_data.index(@rowname)].class.to_s != 'DateTime' and !row[@field_data.index(@rowname)].blank?
end
end
end
@roles = Role.all
@roles.each do |role|
role_statuses = RoleStatus.where(role_id: role.id, :disable=> false)
if !role_statuses.blank?
@rowname = "#{role.key}-status"
if !@field_data.index(@rowname).blank?
@error_msg << "#{make_alpha_from_numbers(@field_data.index(@rowname))}#{index+1}欄位格式不符。" if row[@field_data.index(@rowname)].to_s.split(',').last == row[@field_data.index(@rowname)] and !row[@field_data.index(@rowname)].blank?
end
end
role.attribute_fields.asc(:created_at).each do |attribute_field|
if attribute_field.markup == 'select' or attribute_field.markup == 'radio_button'
@option_list = attribute_field[@field_type[attribute_field.markup]]['option_list'].collect{|p| p[0]}
@rowname = "#{role.key}-#{attribute_field.key}"
if !@field_data.index(@rowname).blank?
@error_msg << "#{make_alpha_from_numbers(@field_data.index(@rowname))}#{index+1}欄位格式不符。" if !@option_list.include?("#{row[@field_data.index(@rowname)]}") and !row[@field_data.index(@rowname)].blank?
end
elsif attribute_field.markup == 'checkbox'
@rowname = "#{role.key}-#{attribute_field.key}"
if !@field_data.index(@rowname).blank?
@error_msg << "#{make_alpha_from_numbers(@field_data.index(@rowname))}#{index+1}欄位格式不符。" if row[@field_data.index(@rowname)].to_s.split(',').last == row[@field_data.index(@rowname)] and !row[@field_data.index(@rowname)].blank?
end
elsif attribute_field.markup == 'date'
@rowname = "#{role.key}-#{attribute_field.key}"
if !@field_data.index(@rowname).blank?
@error_msg << "#{make_alpha_from_numbers(@field_data.index(@rowname))}#{index+1}欄位日期格式不符。" if row[@field_data.index(@rowname)].class.to_s != 'DateTime' and !row[@field_data.index(@rowname)].blank?
end
end
end
end
end
end
end
def import_members
if !params[:file].blank?
import_data_check(params[:file])
if @error_msg.blank?
profile_data_row = ["email","sid","office_tel","sex","birthday"]
profile_lang_data_row = ["first_name","last_name","address","autobiography"]
@field_type = {'text_field' => 'typeA', 'select' => 'typeB', 'date' => 'typeC', 'text_area' => 'typeD', 'radio_button' => 'typeE', 'checkbox' => 'typeE', 'address' => ''}
@date_type = {'format1' => '%Y/%m/%d %H:%M', 'format2' => '%Y/%m/%d', 'format3' => '%Y/%m', 'format4' => '%Y'}
workbook = RubyXL::Parser.parse(params[:file].tempfile)
sheet = workbook['Member'].extract_data
sheet.each_with_index do |row,index|
if index == 0
@field_data = row
end
if index > 2
if !row[0].blank? and !row[1].blank?
@member_profile = MemberProfile.new
@site_in_use_locales.each_with_index do |locale, i|
@member_profile.first_name_translations = @member_profile.first_name_translations.merge!( "#{locale}" => row[@field_data.index("first_name(#{locale})")]) if !row[@field_data.index("first_name(#{locale})")].blank?
@member_profile.last_name_translations = @member_profile.last_name_translations.merge!( "#{locale}" => row[@field_data.index("last_name(#{locale})")]) if !row[@field_data.index("last_name(#{locale})")].blank?
@member_profile.address_translations = @member_profile.address_translations.merge!( "#{locale}" => row[@field_data.index("address(#{locale})")]) if !row[@field_data.index("address(#{locale})")].blank?
@member_profile.autobiography_translations = @member_profile.autobiography_translations.merge!( "#{locale}" => row[@field_data.index("autobiography(#{locale})")]) if !row[@field_data.index("autobiography(#{locale})")].blank?
end
@member_profile.email = row[@field_data.index("email")]
@member_profile.sid = row[@field_data.index("sid")]
@member_profile.office_tel = row[@field_data.index("office_tel")]
@member_profile.sex = ( row[@field_data.index("sex")] == 'male' or row[@field_data.index("sex")] == 'female' ) ? row[@field_data.index("sex")] : 'unknown'
@member_profile.birthday = row[@field_data.index("birthday")].class.to_s == 'DateTime' ? row[@field_data.index("birthday")] : ''
@member_profile.save
@infos = MemberInfo.all
@infos.each do |info|
info.member_profile_fields.each do |member_profile_field|
value = member_profile_field.member_profile_field_values.build
value.member_profile_id = @member_profile.id
if member_profile_field.markup == 'text_field' or member_profile_field.markup == 'text_area'
if member_profile_field[@field_type[member_profile_field.markup]]['cross_lang'] == 'true'
@rowname = "#{info.key}-#{member_profile_field.key}"
value["val"] = row[@field_data.index(@rowname)] if !row[@field_data.index(@rowname)].blank?
else
@site_in_use_locales.each_with_index do |locale, i|
@rowname = "#{info.key}-#{member_profile_field.key}(#{locale})"
value["#{locale}"] = row[@field_data.index(@rowname)] if !row[@field_data.index(@rowname)].blank?
end
end
elsif member_profile_field.markup == 'checkbox'
@rowname = "#{info.key}-#{member_profile_field.key}"
value["val"] = row[@field_data.index(@rowname)].to_s.split(',') if !row[@field_data.index(@rowname)].blank?
elsif member_profile_field.markup == 'date'
@rowname = "#{info.key}-#{member_profile_field.key}"
value["val"] = row[@field_data.index(@rowname)].class.to_s == 'DateTime' ? row[@field_data.index(@rowname)].to_datetime.strftime(@date_type[member_profile_field['typeC']['format']]) : ''
elsif member_profile_field.markup == 'address'
@site_in_use_locales.each_with_index do |locale, i|
@rowname = "#{info.key}-#{member_profile_field.key}(#{locale})"
value["#{locale}"] = row[@field_data.index(@rowname)] if !row[@field_data.index(@rowname)].blank?
end
else
@rowname = "#{info.key}-#{member_profile_field.key}"
value["val"] = "#{row[@field_data.index(@rowname)]}"
end
value.save
end
end
@role_status_data = []
@roles = Role.all
@roles.each do |role|
role_statuses = RoleStatus.where(role_id: role.id, :disable=> false).asc(:_id)
if !role_statuses.blank?
@rowname = "#{role.key}-status"
if !@field_data.index(@rowname).blank?
if !row[@field_data.index(@rowname)].blank?
@status_value = row[@field_data.index(@rowname)].to_s.split(',')
role_statuses.each do |role_status|
if @status_value.include?(role_status.key)
@role_status_data << role_status.id
end
end
end
end
end
@role_add_value = 0
role.attribute_fields.asc(:created_at).each do |attribute_field|
value = attribute_field.attribute_values.build
value.member_profile_id = @member_profile.id
if attribute_field.markup == 'text_field' or attribute_field.markup == 'text_area'
if attribute_field[@field_type[attribute_field.markup]]['cross_lang'] == 'true'
@rowname = "#{role.key}-#{attribute_field.key}"
if !@field_data.index(@rowname).blank?
if !row[@field_data.index(@rowname)].blank?
value["val"] = row[@field_data.index(@rowname)]
@role_add_value = @role_add_value + 1
end
end
else
@site_in_use_locales.each_with_index do |locale, i|
@rowname = "#{role.key}-#{attribute_field.key}(#{locale})"
if !@field_data.index(@rowname).blank?
if !row[@field_data.index(@rowname)].blank?
value["#{locale}"] = row[@field_data.index(@rowname)]
@role_add_value = @role_add_value + 1
end
end
end
end
elsif attribute_field.markup == 'checkbox'
@rowname = "#{role.key}-#{attribute_field.key}"
if !@field_data.index(@rowname).blank?
if !row[@field_data.index(@rowname)].blank?
value["val"] = row[@field_data.index(@rowname)].to_s.split(',')
@role_add_value = @role_add_value + 1
end
end
elsif attribute_field.markup == 'date'
@rowname = "#{role.key}-#{attribute_field.key}"
if !@field_data.index(@rowname).blank?
value["val"] = row[@field_data.index(@rowname)].class.to_s == 'DateTime' ? row[@field_data.index(@rowname)].to_datetime.strftime(@date_type[attribute_field['typeC']['format']]) : ''
end
elsif attribute_field.markup == 'address'
@site_in_use_locales.each_with_index do |locale, i|
@rowname = "#{role.key}-#{attribute_field.key}(#{locale})"
if !@field_data.index(@rowname).blank?
if !row[@field_data.index(@rowname)].blank?
value["#{locale}"] = row[@field_data.index(@rowname)]
@role_add_value = @role_add_value + 1
end
end
end
else
@rowname = "#{role.key}-#{attribute_field.key}"
if !@field_data.index(@rowname).blank?
if !row[@field_data.index(@rowname)].blank?
value["val"] = "#{row[@field_data.index(@rowname)]}"
@role_add_value = @role_add_value + 1
end
end
end
value.save
end
if @role_add_value > 0
role.member_profiles << @member_profile
role.save
end
end
if !@role_status_data.blank?
@member_profile.role_status_ids = @role_status_data
@member_profile.save
end
@user = User.new(
user_name: row[@field_data.index("user_id")],
password: row[@field_data.index("password")],
member_profile_id: @member_profile.id,
approved: true
)
@user.save
end
end
end
redirect_to admin_members_path
else
render 'import_error_msg'
end
end
end
def download_export
@users = User.all
@member_role = params[:member_role].blank? ? Role.all.asc(:_id) : params[:member_role]
@member_roles = @member_role.collect{|a| a[0]}
respond_to do |format|
format.xlsx {
response.headers['Content-Disposition'] = 'attachment; filename="member_import_data.xlsx"'
}
end
end end
def new def new
if has_access?
@member = MemberProfile.new @member = MemberProfile.new
get_info_and_roles get_info_and_roles
@user = User.new @user = User.new
@form_index = 0 @form_index = 0
else
render_401
end
end end
def edit def edit
param_temp = request.fullpath.split("?")
@edit_params = (param_temp.count > 1 ? "?" + param_temp.last : "") rescue ""
if has_access?
@form_index = 0 @form_index = 0
get_info_and_roles get_info_and_roles
if @member.user.present? if @member.user.present?
@ -106,13 +461,22 @@ class Admin::MembersController < OrbitMemberController
else else
@user = User.new(member_profile_id: @member.id) @user = User.new(member_profile_id: @member.id)
end end
else
render_401
end
end end
def create def create
@member = MemberProfile.new(member_profile_params) @member = MemberProfile.new(member_profile_params)
@user = User.new(user_params) rescue nil
if @member.save if @member.save
@user.member_profile_id = @member.id if user_params["user_name"] != ""
@user = User.new(user_params) rescue nil
@user.member_profile = @member
if !@user.save
@member.destroy
render 'new' and return
end
end
if !params[:member_profile_field_values].nil? if !params[:member_profile_field_values].nil?
params[:member_profile_field_values].each_with_index do |m,i| params[:member_profile_field_values].each_with_index do |m,i|
@custom_field_value = @member.member_profile_field_values.build(value: m.second["value"], member_profile_field_id: m.second["member_profile_field_id"]) @custom_field_value = @member.member_profile_field_values.build(value: m.second["value"], member_profile_field_id: m.second["member_profile_field_id"])
@ -127,22 +491,30 @@ class Admin::MembersController < OrbitMemberController
end end
end end
@user.save
redirect_to admin_members_path redirect_to admin_members_path
else else
redirect_to new_admin_member_path render 'new'
end end
end end
def update def update
param_temp = request.fullpath.split("?")
@edit_params = (param_temp.count > 1 ? "?" + param_temp.last : "") rescue ""
respond_to do |format| respond_to do |format|
if @member.update_attributes(member_profile_params)
if @member.user.present? if @member.user.present?
@member.user.update(user_params) @user = @member.user
@user.update(user_params)
else else
@user = User.new(user_params) if user_params["user_name"] != ""
@user = User.new(user_params) rescue nil
@user.member_profile = @member
@user.save @user.save
@user.update_attributes(member_profile_id: @member.id) end
end
if @member.update_attributes(member_profile_params)
if params[:edit_type]!="edit_privilege" and (params[:member_profile].nil? or params[:member_profile][:role_status_ids].nil?)
@member.update_attributes(role_status_ids: [])
end end
if !params[:member_profile_field_values].nil? if !params[:member_profile_field_values].nil?
params[:member_profile_field_values].each_with_index do |m,i| params[:member_profile_field_values].each_with_index do |m,i|
@ -158,15 +530,15 @@ class Admin::MembersController < OrbitMemberController
if !params[:role_field_values].nil? if !params[:role_field_values].nil?
params[:role_field_values].each_with_index do |r,i| params[:role_field_values].each_with_index do |r,i|
field_value = r.last[:id].present? field_value = r.last[:id].present?
@custom_field_value = AttributeValue.put_field_values(@member, r.last, r.last[:attribute_field_id], field_value) @custom_field_value = AttributeValue.put_field_values(@member, r.last, r.last[:id], field_value)
end end
end end
if params[:workgroup_id] if params[:edit_type]=="edit_privilege"
@member.user.update_attributes(workgroup_id: params[:workgroup_id]) @member.user.update_attributes(workgroup_id: params[:workgroup_id])
end end
format.html { redirect_to admin_members_path, notice: 'Successfully Updated the User' } format.html { redirect_to admin_members_path() + @edit_params, notice: 'Successfully Updated the User' }
format.json { head :no_content } format.json { head :no_content }
else else
format.html { render action: 'edit' } format.html { render action: 'edit' }
@ -181,7 +553,9 @@ class Admin::MembersController < OrbitMemberController
else else
@member_profile = MemberProfile.find(params[:id]) @member_profile = MemberProfile.find(params[:id])
@member_profile.user.delete if @member_profile.user.present? @member_profile.user.delete if @member_profile.user.present?
@member_profile.delete @member_profile.destroy
@member_profile.roles.clear
@member_profile.role_statuses.clear
end end
respond_to do |format| respond_to do |format|
@ -190,7 +564,7 @@ class Admin::MembersController < OrbitMemberController
end end
def unapproved_members def unapproved_members
@member_query = params[:member_query] @member_query = Sanitize.clean(params[:member_query])
page_num = params[:page] || 1 page_num = params[:page] || 1
if !@member_query.blank? if !@member_query.blank?
members = MemberProfile.all.any_of({:user_id => /#{@member_query}/i}, {:first_name => /#{@member_query}/i}, {:last_name => /#{@member_query}/i}, {:email => /#{@member_query}/i}) members = MemberProfile.all.any_of({:user_id => /#{@member_query}/i}, {:first_name => /#{@member_query}/i}, {:last_name => /#{@member_query}/i}, {:email => /#{@member_query}/i})
@ -212,17 +586,20 @@ class Admin::MembersController < OrbitMemberController
end end
def edit_passwd def edit_passwd
if has_access?
@user = @member.user @user = @member.user
if current_user.id == @user.id else
redirect_to :action => :index render_401
end end
end end
def edit_privilege def edit_privilege
@edit_params = "?" + request.fullpath.split("?").last rescue ""
if current_user.is_admin?
@user = @member.user @user = @member.user
@workgroup = Workgroup.find_by(key: 'admin') @workgroup = Workgroup.find_by(key: 'admin')
if current_user.id == @user.id else
redirect_to :action => :index render_401
end end
end end
@ -233,7 +610,7 @@ class Admin::MembersController < OrbitMemberController
end end
def edit_order_list def edit_order_list
@members = MemberProfile.order('created_at DESC') @members = MemberProfile.order(:position=>'asc',:created_at=>'desc')
@type = 'list' @type = 'list'
render 'edit_order' render 'edit_order'
end end
@ -256,27 +633,35 @@ class Admin::MembersController < OrbitMemberController
end end
def update_order_list def update_order_list
@error = [] if params[:position].present?
if params[:users].present? params[:position].each do |id, position|
params[:users].values.sort.each do |pair| profile = MemberProfile.find(id)
to_go = pair[0].to_i profile.position = position.to_i
profile.save(:validate => false)
end
end
# @error = []
# if params[:users].present?
# params[:users].values.sort.each do |pair|
# to_go = pair[0].to_i
if to_go > 0 # if to_go > 0
member_at_position = MemberProfile.where(position: to_go).first # member_at_position = MemberProfile.where(position: to_go).first
member = MemberProfile.find(pair[1]) # member = MemberProfile.find(pair[1])
if member_at_position && !(member_at_position == member) # if member_at_position && !(member_at_position == member)
if member.position > member_at_position.position # if member.position > member_at_position.position
member.move_above(member_at_position) # member.move_above(member_at_position)
else # else
member.move_below(member_at_position) # member.move_below(member_at_position)
end # end
elsif to_go > MemberProfile.count # elsif to_go > MemberProfile.count
member.move_to_bottom # member.move_to_bottom
end # end
end # end
end # end
end # end
@members = MemberProfile.asc(:position) # @members = MemberProfile.asc(:position)
render :nothing=>true
end end
def setting_account def setting_account
@ -290,6 +675,12 @@ class Admin::MembersController < OrbitMemberController
end end
end end
def get_role_fields
role = Role.find(params[:id])
statuses = role.role_statuses.map{|status| {'key'=>status.key, 'title'=>status.title}}.select{|s| s['key']='part_time'}
render :json=>{"statuses"=>statuses}
end
private private
# Use callbacks to share common setup or constraints between actions. # Use callbacks to share common setup or constraints between actions.
@ -322,7 +713,7 @@ class Admin::MembersController < OrbitMemberController
protected protected
def get_info_and_roles def get_info_and_roles
@roles = Role.excludes(disabled: true) @roles = Role.excludes(disabled: true).asc(:key)
@infos = MemberProfileField.excludes(disabled: true) @infos = MemberProfileField.excludes(disabled: true)
end end

View File

@ -1,28 +1,33 @@
class Admin::ModuleStoreController < OrbitAdminController class Admin::ModuleStoreController < OrbitAdminController
layout "structure" layout "structure"
include Admin::ModuleStoreHelper
def index def index
@extensions = [] @extensions = []
if current_site.site_token? # if current_site.site_token?
if current_site.store_confirmation # if current_site.store_confirmation
@extensions = get_extensions # @extensions = get_extensions
@store_confirmation = true # @store_confirmation = true
else # else
@extensions = [] # @extensions = []
@store_confirmation = false # @store_confirmation = false
end # end
@downloaded_extensions = get_downloaded_extension
else # else
@store_confirmation = true # @store_confirmation = true
@extensions = [] # @extensions = []
@downloaded_extensions = get_downloaded_extension # @downloaded_extensions = get_downloaded_extension
end # end
end end
def show def show
@extension = get_extension(params[:id]) rescue nil @extension = get_extension(params[:id]) rescue nil
end end
def modules_to_update
@built_in_extensions = get_built_in_extensions
render :partial => "modules_to_update"
end
def download def download
#get extension related values #get extension related values
extension = get_extension(params[:id]) rescue nil extension = get_extension(params[:id]) rescue nil
@ -94,7 +99,24 @@ class Admin::ModuleStoreController < OrbitAdminController
end end
def restart def restart
Bundler.with_clean_env { `cd #{Rails.root} && bundle install` } Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=built_in_extensions.rb bundle update && bundle` }
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=downloaded_extensions.rb bundle update && bundle` }
@built_in_extensions = get_built_in_extensions
render :partial => "modules_to_update"
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
sleep 5
end
def update_module
key = params["key"]
type = params["type"]
# if type == "built_in"
# Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=built_in_extensions.rb bundle update #{key}` }
# elsif type == "downloaded"
# Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=downloaded_extensions.rb bundle update #{key}` }
# end
Bundler.with_clean_env { `cd #{Rails.root} && bundle update #{key}` }
render :nothing => true
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`) %x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
sleep 5 sleep 5
end end
@ -132,20 +154,6 @@ class Admin::ModuleStoreController < OrbitAdminController
store_session.get_extension(id) store_session.get_extension(id)
end end
def get_downloaded_extension
downloaded_extensions = []
extensions = File.new("#{Rails.root}/downloaded_extensions.rb", "r")
while (extension = extensions.gets)
status = !extension.start_with?("# ")
extension = extension.split(',')
downloaded_extensions << {'name' => extension[0].split(/[\'\"]/)[1], 'repo' => extension[1].split(/[\'\"]/)[1], 'tag' => extension[2].split(/[\'\"]/)[1], 'status' => status}
end
extensions.close
downloaded_extensions.to_json
end
def toggle_item(module_key, active) def toggle_item(module_key, active)
if !module_key.nil? if !module_key.nil?

View File

@ -1,5 +1,6 @@
class Admin::PersonalPluginIntrosController < OrbitMemberController class Admin::PersonalPluginIntrosController < OrbitMemberController
def index def index
if has_access?
get_types get_types
@plugin_intro = @types.where(member_profile_id: params[:member_profile_id]).first rescue nil @plugin_intro = @types.where(member_profile_id: params[:member_profile_id]).first rescue nil
@ -12,9 +13,15 @@ class Admin::PersonalPluginIntrosController < OrbitMemberController
@url = polymorphic_path(["admin", @plugin_intro]) @url = polymorphic_path(["admin", @plugin_intro])
@verb = :put @verb = :put
end end
else
render_401
end
end end
def new def new
if !has_access?
render_401
end
end end
def show def show
@ -34,6 +41,9 @@ class Admin::PersonalPluginIntrosController < OrbitMemberController
end end
def edit def edit
if !has_access?
render_401
end
end end
def update def update

View File

@ -3,7 +3,7 @@ class Admin::RoleStatusesController < OrbitMemberController
def index def index
@role = Role.find(params[:role_id]) rescue nil @role = Role.find(params[:role_id]) rescue nil
@role_statuses = RoleStatus.where(role_id: @role.id) if @role @role_statuses = RoleStatus.where(role_id: @role.id).asc(:key) if @role
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
@ -42,8 +42,11 @@ class Admin::RoleStatusesController < OrbitMemberController
end end
def toggle def toggle
@role_status.disable = @role_status.disable ? false : true role_status = RoleStatus.find(params[:role_status_id]) rescue nil
@role_status.save! if !role_status.nil?
role_status.disable = role_status.disable ? false : true
role_status.save!
end
render action: :index render action: :index
end end

View File

@ -4,7 +4,7 @@ class Admin::RolesController < OrbitMemberController
helper Admin::AttributeValuesViewHelper helper Admin::AttributeValuesViewHelper
def index def index
@roles = Role.all.asc("_id").entries @roles = Role.all.asc(:key).entries
end end
def show def show

View File

@ -1,5 +1,7 @@
class Admin::SitesController < OrbitAdminController class Admin::SitesController < OrbitAdminController
before_filter :get_site before_filter :get_site
before_filter :set_git_branch, :only=>[:check_updates, :update_orbit]
layout "structure" layout "structure"
def mail_setting def mail_setting
@ -53,9 +55,6 @@ class Admin::SitesController < OrbitAdminController
def preference def preference
end end
def update_manager
end
def update_orbit def update_orbit
end end
@ -67,11 +66,18 @@ class Admin::SitesController < OrbitAdminController
elsif params[:site][:enable_language_detection].eql?("1") elsif params[:site][:enable_language_detection].eql?("1")
Site.update_all({:default_locale => nil}) Site.update_all({:default_locale => nil})
end end
if !@site.in_use_locales.include?I18n.locale
I18n.locale = @site.in_use_locales.first
redirect_to admin_site_preference_path(current_site)
else
redirect_to :back redirect_to :back
end end
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
sleep 5
end
def update_manager def update_manager
@store_permissions = check_store_permissions
end end
def get_update_history def get_update_history
@ -80,29 +86,40 @@ class Admin::SitesController < OrbitAdminController
end end
def check_updates def check_updates
if (@current_tag.eql?(@latest_tag) == false)
%x(git fetch origin) %x(git fetch origin)
end @new_updates = %x(git log #{@branch}..origin/#{@branch} --pretty=format:"%ad','%s" --date=short).split("\n").map{|log| log.gsub("'","").split(",")}.to_json
@new_updates = %x(git log "#{@current_tag}"..."#{@latest_tag}" --pretty=format:"%ad','%s" --date=short).split("\n").map{|log| log.gsub("'","").split(",")}.to_json
render :json => @new_updates render :json => @new_updates
end end
def update_orbit def update_orbit
store_permissions = check_store_permissions
if store_permissions["permission_granted"]
result = "" result = ""
need_stash = %x(git diff).blank? need_stash = %x(git diff).blank?
%x(git stash) unless need_stash %x(git stash) unless need_stash
%x(git fetch origin) %x(git fetch origin)
pull_result = %x(git pull -r --ff-only 2>&1 origin #{@latest_tag}) pull_result = %x(git pull -r --ff-only 2>&1 origin #{@branch})
%x(git stash pop) unless need_stash %x(git stash pop) unless need_stash
if pull_result.include? "fatal: Not possible to fast-forward, aborting." if pull_result.include? "fatal: Not possible to fast-forward, aborting."
result = "failed" result = "failed"
else else
result = "success" result = "success"
Bundler.with_clean_env { `cd #{Rails.root} && bundle install` } # Bundler.with_clean_env { `cd #{Rails.root} && bundle update` }
end end
render :text => result render :text => result
else
render :json => store_permissions.to_json
end
end
def bundle_install
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=built_in_extensions.rb bundle update && bundle` }
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=downloaded_extensions.rb bundle update && bundle` }
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
sleep 5
render :nothing => true
end end
def restart_server def restart_server
@ -113,7 +130,7 @@ class Admin::SitesController < OrbitAdminController
private private
def get_site def get_site
@site = Site.first @site = @current_site.nil? ? Site.first : @current_site
end end
def site_params def site_params
@ -142,12 +159,7 @@ class Admin::SitesController < OrbitAdminController
end end
def git_branch def set_git_branch
@branch = %x(git rev-parse --abbrev-ref HEAD).gsub("\n","") @branch = %x(git rev-parse --abbrev-ref HEAD).gsub("\n","")
end end
def git_tags
@current_tag = %x(git describe --tags).gsub("\n","").split("-").first
@latest_tag = `git ls-remote --tags origin | awk '{print $2}'`.split(/\n/).last.gsub("refs/tags/","") rescue nil
end
end end

View File

@ -0,0 +1,101 @@
require "uri"
require "net/http"
class Admin::StoreController < OrbitAdminController
layout false
before_action :store_url
def check_credentials
if current_site.store_token.nil?
render :json => {"success" => false}.to_json
else
render :json => {"success" => true}.to_json
end
end
def register_form
tt = current_site.title_translations
@site_title_values = {}
@site_title_values["en"] = tt["en"]
@site_title_values["zh_tw"] = tt["zh_tw"]
end
def template_store
end
def app_store
end
def send_email
params_to_send = {'store_token' => current_site.store_token}
uri = URI.parse(@store_url)
http = Net::HTTP.new(uri.host,uri.port)
request = Net::HTTP::Get.new("/site/send_email")
request.body = params_to_send.to_query
response = http.request(request)
data = JSON.parse(response.body)
render :json => data.to_json
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
sleep 5
end
def authorize_default_modules
modules = ModuleApp.all
ids = modules.collect{|ma| ma.key}
store_token = Site.first.store_token rescue nil
if !store_token.nil?
module_apps = ModuleApp.all
params_to_send = {'store_token' => store_token, "apps" => ids}
uri = URI.parse(OrbitStore::URL)
http = Net::HTTP.new(uri.host,uri.port)
request = Net::HTTP::Post.new("/store/register_old_sites_modules")
request.body = params_to_send.to_query
response = http.request(request) rescue nil
if response.nil?
render :json => {"success" => false, "message" => "Could not connect to the store."}.to_json
else
data = JSON.parse(response.body)
if data["success"]
render :json => {"success" => true}.to_json
elsif !data["success"]
render :json => {"success" => false, "message" => data["message"]}.to_json
end
end
else
render :json => {"success" => false, "message" => "Cannot register modules, site is not registered with store."}.to_json
end
end
def check_permissions
params_to_send = {'store_token' => current_site.store_token}
uri = URI.parse(@store_url)
http = Net::HTTP.new(uri.host,uri.port)
request = Net::HTTP::Get.new("/site/permissions")
request.body = params_to_send.to_query
response = http.request(request)
data = JSON.parse(response.body)
if !data["success"] && data["error"] == "INVALID_SITE_TOKEN"
current_site.store_token = nil
current_site.save
end
render :json => data.to_json
end
def register_site
params_to_send = {'site_domain' => request.host_with_port, 'admin_email' => params["email"], "site_token" => current_site.uid, "site_title" => params[:site_title] }
uri = URI.parse(@store_url)
http = Net::HTTP.new(uri.host,uri.port)
request = Net::HTTP::Post.new("/register/site")
request.body = params_to_send.to_query
response = http.request(request)
data = JSON.parse(response.body)
render :json => data.to_json
end
private
def store_url
@store_url = OrbitStore::URL
# @store_url = "http://localhost:3000"
end
end

View File

@ -109,7 +109,7 @@ class Admin::TagsController < OrbitAdminController
def setup_vars def setup_vars
@is_module_tag = !params[:module_app_id].blank? @is_module_tag = !params[:module_app_id].blank?
@module_apps = @is_module_tag ? [ModuleApp.find(params[:module_app_id])] : ModuleApp.where(categorizable: true) @module_apps = @is_module_tag ? [ModuleApp.find(params[:module_app_id])] : ModuleApp.where(taggable: true)
@module_app = @is_module_tag ? ModuleApp.find(params[:module_app_id]) : ModuleApp.find_by(:key=>'tag') @module_app = @is_module_tag ? ModuleApp.find(params[:module_app_id]) : ModuleApp.find_by(:key=>'tag')
end end

View File

@ -1,5 +1,6 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception. # Prevent CSRF attacks by raising an exception.
protect_from_forgery
# For APIs, you may want to use :null_session instead. # For APIs, you may want to use :null_session instead.
# protect_from_forgery with: :null_session # protect_from_forgery with: :null_session
before_action :set_locale, :set_mobile_web before_action :set_locale, :set_mobile_web
@ -13,6 +14,7 @@ class ApplicationController < ActionController::Base
in_use_locales = current_site.in_use_locales in_use_locales = current_site.in_use_locales
if params[:locale].eql?("zh_cn") or (!params[:locale] and session[:zh_cn]) if params[:locale].eql?("zh_cn") or (!params[:locale] and session[:zh_cn])
redirect_to root_path if !current_site.enable_zh_cn
params[:locale] = "zh_tw" params[:locale] = "zh_tw"
I18n.locale = session[:locale] I18n.locale = session[:locale]
session[:zh_cn] = true session[:zh_cn] = true
@ -27,7 +29,7 @@ class ApplicationController < ActionController::Base
if !params[:locale] and !session[:locale] if !params[:locale] and !session[:locale]
if current_site.enable_language_detection if current_site.enable_language_detection
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].split(',').first.underscore rescue nil browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].split(',').first.underscore rescue nil
session[:locale] = in_use_locales.include?(browser_locale.to_sym) ? browser_locale : nil session[:locale] = (in_use_locales.include?(browser_locale.to_sym) ? browser_locale : nil) rescue nil
elsif current_site.default_locale elsif current_site.default_locale
session[:locale] = current_site.default_locale session[:locale] = current_site.default_locale
end end
@ -50,7 +52,7 @@ class ApplicationController < ActionController::Base
end end
def current_site def current_site
@current_site = Site.first @current_site = @current_site.nil? ? Site.first : @current_site
end end
def frontent_allowed def frontent_allowed
@ -61,6 +63,10 @@ class ApplicationController < ActionController::Base
path = request.path.split('/') path = request.path.split('/')
is_mobile_path = ( (path[1].eql?("mobile") or path[2].eql?("mobile")) or params[:mobile].eql?("1") ) is_mobile_path = ( (path[1].eql?("mobile") or path[2].eql?("mobile")) or params[:mobile].eql?("1") )
if params[:editmode] == "on"
$temp_mobile = session[:mobile]
end
if params[:mobile].eql?("0") if params[:mobile].eql?("0")
session[:desktop] = true session[:desktop] = true
session[:mobile] = false session[:mobile] = false
@ -97,9 +103,10 @@ class ApplicationController < ActionController::Base
log.request_method = request.request_method log.request_method = request.request_method
log.remote_ip = request.remote_ip log.remote_ip = request.remote_ip
log.referer = request.referer log.referer = request.referer
log.save begin
current_user.user_actions << log if log.save
current_user.user_actions << log rescue
end
end end
end end
@ -115,7 +122,7 @@ class ApplicationController < ActionController::Base
private private
def current_user def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id] rescue nil @current_user = @current_user.nil? ? (User.find(session[:user_id]) if session[:user_id] rescue nil) : @current_user
end end
protected protected
@ -127,7 +134,10 @@ class ApplicationController < ActionController::Base
redirect_to new_session_path if @current_user.nil? redirect_to new_session_path if @current_user.nil?
return true return true
else elsif current_site.backend_openness_on
return true
elsif
session[:login_referer] = request.url
redirect_to new_session_path redirect_to new_session_path
return false return false
end end

View File

@ -1,217 +1,294 @@
class MembersController < ApplicationController class MembersController < ApplicationController
def index def index
statuses = OrbitHelper.page_categories page_roles = OrbitHelper.page_categories
@statuses = [] page_role_status = OrbitHelper.page_role_status
if statuses.first == "all" params = OrbitHelper.params
module_app = OrbitHelper.this_module_app page = Page.where(:page_id => params[:page_id]).first rescue nil
@statuses = module_app.role_status.collect do |stat| fields_to_show = page.custom_array_field if !page.nil? rescue []
{ fields_to_show = [
"status" => stat.title, {"key"=>"name", "type"=>"profile","sort_order"=>2,"link_to_show"=>true},
"id" => stat.id.to_s, {"key"=>"email", "type"=>"profile"},
"status-role" => stat.role.title, {"key"=>"office_tel", "type"=>"profile"}
"rs" => stat ] if fields_to_show.blank?
}
end
else
statuses.each do |stat|
s = RoleStatus.find(stat)
@statuses << {"status" => s.title, "id" => s.id.to_s, "rs" => s, "status-role" => s.role.title}
end
end
stats = @statuses.collect do |status|
members = status["rs"].member_profiles
member_list = members.collect do |member|
if member.avatar.present?
image = member.avatar.thumb.url
else
image = "http://placehold.it/100x100"
end
roles = member.roles.collect do |role|
{
"role" => role.title
}
end
{
"name" => member.name,
"roles" => roles,
"img_src" => image,
"email" => member.email,
"link_to_show" => OrbitHelper.url_to_show(member.to_param)
}
if OrbitHelper.member_sort_position
sort = "data['list_order']"
else
sort = fields_to_show
.collect.with_index{|field,idx| {'sort_order'=>field['sort_order'], 'index'=>idx}}
.select{|field|!field['sort_order'].blank?}
.sort_by{|field|field['sort_order']}
.collect.with_index{|field| "data['profile_data'][#{field['index']}]['sort_value'] rescue 0"}
sort = '[('+sort.join('),(')+')]'
end
if page_roles.include?("all")
roles = Role.all.collect do |role|
{ "title" => role.title, "id" => role.id }
end
else
page_role_status.each do |status_id|
page_roles << RoleStatus.find(status_id).role.id.to_s
end
roles = Role.find(page_roles.uniq).collect do |role|
{ "title" => role.title, "id" => role.id, "status" => RoleStatus.where(:role_id=>role, :_id.in=>page_role_status).asc(:key).to_a }
end
end
role_list = []
roles.each do |role|
status_list = []
if !role['status'].blank?
role['status'].each do |status|
member_profiles = get_members_by_status(status, sort, fields_to_show)
status_list << { "status-title" => status.title, "members" => member_profiles } if !member_profiles.blank?
end
else
# Members with status
role_status = RoleStatus.order_by(:key=>"asc").where(:role_id=>role['id'])
role_status_ids = role_status.collect{|status| status.id.to_s}
role_status.each do |status|
member_profiles = get_members_by_status(status, sort, fields_to_show)
next if member_profiles.blank?
status_list << { "status-title" => status.title, "members" => member_profiles }
end
# Members without status
member_profiles = []
MemberProfile.not_in(:role_status_ids.in=>role_status_ids).where(:role_ids.in=>[role['id']]).collect do |profile|
member_profiles << get_member_data(profile, fields_to_show)
end
member_profiles = member_profiles.sort_by{|data| eval(sort)} rescue member_profiles
status_list << { "status-title" => role['title'], "members" => member_profiles } if !member_profiles.blank?
end
role_list << { "role-title" => role['title'], "status-list" => status_list }
end end
{ {
"status-title" => status["status"], "roles" => role_list,
"role-title" => status["status-role"], "extras" => {
"members" => member_list "widget-title"=>t(:member_)
}
} }
end end
def get_members_by_status(status, sort, fields_to_show)
member_profiles = []
status.member_profiles.each do |member|
member_profiles<<get_member_data(member, fields_to_show)
end
return member_profiles.sort_by{|data| eval(sort)} rescue member_profiles
end
def get_member_data(member, fields_to_show)
image = member.avatar.present? ? member.avatar.thumb.url : ActionController::Base.helpers.asset_path('member-pic.png')
{ {
"stats" => stats, 'profile_data'=>member_data(member, fields_to_show),
"extras" => {"widget-title" => "Members"} 'list_order' => member.position,
'name' => member.name,
'image'=>image,
"link_to_show" => OrbitHelper.url_to_show(member.to_param)
} }
end end
def show def show
params = OrbitHelper.params params = OrbitHelper.params
member = MemberProfile.find_by(uid: params[:uid]) member = MemberProfile.find_by(uid: params[:uid])
profile_data = []
#role status
member.roles.where(:disabled => false).asc("_id").collect do |role|
role_status = member.role_statuses.where(role_id: role.id).map{|t|t.title.to_s}.join(',') rescue ''
profile_data = profile_data.push({"key"=>"role_status", "title"=>"", "value"=> role_status, "title_class"=>"member-data-title-role-status", "value_class"=>"member-data-value-role-status"}) if !role_status.blank?
attribute_field = role.attribute_fields.where(:key => 'job_title').first
profile_data = profile_data + member_data(member, [{"id"=> attribute_field.id.to_s, "key"=> attribute_field.key, "type"=>"role"}]) if !attribute_field.blank? and !attribute_field.to_show.blank?
end
fields_to_show = [
{"key"=>"name", "type"=>"profile"},
{"key"=>"office_tel", "type"=>"profile"},
{"key"=>"email", "type"=>"profile"}
]
profile_data = profile_data + member_data(member, fields_to_show)
profile_fields_to_show = []
# member info
infos = MemberInfo.order('created_at DESC')
infos.each do |info|
info.member_profile_fields.each do |member_profile_field|
profile_fields_to_show << {"id"=> member_profile_field.id.to_s, "key"=> member_profile_field.key, "type"=>"custom"} if !member_profile_field.to_show.blank?
end
end
profile_data = profile_data + member_data(member, profile_fields_to_show)
# member role
role_fields_to_show = []
member.roles.where(:disabled => false).asc("_id").collect do |role|
role.attribute_fields.where(:key.ne => 'job_title').asc("_id").each do |attribute_field|
role_fields_to_show << {"id"=> attribute_field.id.to_s, "key"=> attribute_field.key, "type"=>"role"} if !attribute_field.to_show.blank?
end
end
profile_data = profile_data + member_data(member, role_fields_to_show)
# member plugin
plugins = OrbitApp::Plugin::Registration.all rescue nil plugins = OrbitApp::Plugin::Registration.all rescue nil
plugin_list = plugins.collect do |plugin| plugin_list = plugins.collect.with_index do |plugin, idx|
intro = PersonalPluginIntro.find_by(member_profile_id:member.id, _type: "#{plugin.app_name}Intro") rescue nil
intro = PersonalPluginIntro.find_by(member_profile_id: member.id, _type: "#{plugin.app_name}Intro") rescue nil
if intro.nil? or intro.complete_list
if intro.nil?
plugin_data = plugin.app_name.constantize.where(member_profile_id: member) rescue nil plugin_data = plugin.app_name.constantize.where(member_profile_id: member) rescue nil
pd = plugin_data.collect do |p| pd = plugin_data.collect do |p|
slug_title = ["JournalPaper","WritingConference"].include?(plugin.app_name) ? p.create_link : p.slug_title
{ {
"data_title" => p.slug_title, "data_title" => slug_title,
"link_to_show" => OrbitHelper.url_to_plugin_show(p.to_param,plugin.module_app_name.underscore) "link_to_show" => OrbitHelper.url_to_plugin_show(p.to_param,plugin.module_app_name.underscore)
} }
end end
if plugin.app_name == 'JournalPaper' or plugin.app_name == 'WritingConference' or plugin.app_name == 'Book'
pd_title = {}
plugin_datas = plugin_data.where(:is_hidden=>false).desc(:year).collect do |p|
{
"pd_datas" => [{ "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,plugin.module_app_name.underscore)}' target='_blank'>#{p.create_link}" }]
}
end
else
datas = plugin.app_name.constantize.get_plugin_datas_to_member(plugin_data)
pd_title = datas[0] rescue {}
plugin_datas = datas[1] rescue {}
end
end
if !intro.blank?
if !intro.brief_intro.blank?
pdi = []
pdi << {"data_intro_title" => intro.text.html_safe}
end
if intro.complete_list.blank?
complete_display = "hide"
pd_title = {}
plugin_datas = {}
end
if intro.brief_intro.blank?
brief_display = "hide"
pdi = {}
end
else
pdi = [{"data_intro_title" => ''}] if !plugin_datas.blank?
end
{ {
"plugin_data" => pd, "plugin_data" => pd,
"plugin_title" => plugin.app_name.titleize "pd_title" => pd_title,
"plugin_datas" => plugin_datas,
"plugin_data_intro" => pdi,
"complete_display" => complete_display,
"brief_display" => brief_display,
"plugin_name" => plugin.module_app_name.underscore,
"plugin_title" => t('module_name.'+plugin.module_app_name.underscore),
"plugin_class" => idx==0 ? "active" : ""
} }
elsif intro.complete_list == true
plugin_data = plugin.app_name.constantize.where(member_profile_id: member) rescue nil
pd = plugin_data.collect do |p|
{
"data_title" => p.slug_title,
"link_to_show" => OrbitHelper.url_to_plugin_show(p.to_param,plugin.module_app_name.underscore)
}
end
{
"plugin_data" => pd,
"plugin_title" => plugin.app_name.titleize
}
# end
elsif intro.brief_intro == true
pd = []
pd << {"data_title" => intro.text.html_safe}
{
"plugin_data" => pd,
"plugin_title" => plugin.app_name.titleize
}
end
end end
if member.avatar.present?
image = member.avatar.thumb.url
else
image = "http://placehold.it/100x100"
end
custom_fields = member.member_profile_field_values.collect do |cf| plugin_list = plugin_list.reject{|plugin| plugin['plugin_datas'].blank? and plugin['plugin_data_intro'].blank?}
if (cf.member_profile_field.markup.eql?("text_field") || cf.member_profile_field.markup.eql?("text_area"))
custom_field_value = cf.value[I18n.locale]
elsif (cf.member_profile_field.markup.eql?("select") || cf.member_profile_field.markup.eql?("radio_button"))
custom_field_value = cf.member_profile_field.markup_value["#{cf.value}"][I18n.locale] rescue nil
elsif cf.member_profile_field.markup.eql?("address")
custom_field_value = cf[:address_key][I18n.locale].map{|k,v| v}.delete_if(&:blank?).join(', ')
elsif cf.member_profile_field.markup.eql?("date")
case cf.member_profile_field.typeC['format']
when 'format1'
custom_field_value = cf.value.to_date.strftime("%Y/%m/%d")
when 'format2'
custom_field_value = cf.value.to_date.strftime("%Y/%m/%d")
when 'format3'
custom_field_value = cf.value.to_date.strftime("%Y/%m")
when 'format4'
custom_field_value = cf.value.to_date.strftime("%Y")
end
elsif cf.member_profile_field.markup.eql?("checkbox")
custom_field_value = cf.value.map {|v| cf.member_profile_field.markup_value["#{v}"][I18n.locale]}.join(', ') rescue nil
end
if !custom_field_value.blank?
{ {
"custom_field_title" => cf.member_profile_field.title,
"custom_field_value" => custom_field_value
}
else
{
"custom_field_title" => "",
"custom_field_value" => ""
}
end
end
custom_fields_final = custom_fields.map {|c| c.delete_if {|k,v| (v.nil? || v.blank?)}}.delete_if(&:blank?)
role_fields = member.attribute_values.collect do |rf|
if (rf.attribute_field.markup.eql?("text_field") || rf.attribute_field.markup.eql?("text_area"))
role_field_value = rf.value[I18n.locale]
elsif (rf.attribute_field.markup.eql?("select") || rf.attribute_field.markup.eql?("radio_button"))
role_field_value = rf.attribute_field.markup_value["#{rf.value}"][I18n.locale] rescue nil
elsif rf.attribute_field.markup.eql?("address")
role_field_value = rf[:address_key][I18n.locale].map{|k,v| v}.delete_if(&:blank?).join(', ')
elsif rf.attribute_field.markup.eql?("date")
case rf.attribute_field.typeC['format']
when 'format1'
role_field_value = rf.value.to_date.strftime("%Y/%m/%d")
when 'format2'
role_field_value = rf.value.to_date.strftime("%Y/%m/%d")
when 'format3'
role_field_value = rf.value.to_date.strftime("%Y/%m")
when 'format4'
role_field_value = rf.value.to_date.strftime("%Y")
end
elsif rf.attribute_field.markup.eql?("checkbox")
role_field_value = rf.value.map {|v| rf.attribute_field.markup_value["#{v}"][I18n.locale]}.join(', ') rescue nil
end
if !role_field_value.blank?
{
"role_field_title" => rf.attribute_field.title,
"role_field_value" => role_field_value
}
else
{
"role_field_title" => "",
"role_field_value" => ""
}
end
end
role_fields_final = role_fields.map {|r| r.delete_if {|k,v| (v.nil? || v.blank?)}}.delete_if(&:blank?)
roles = member.roles.collect do |role|
{
"role" => role.title
}
end
data = []
member.values_for_show.each do |key,value|
data << {"key" => key.humanize, "value" => value}
end
autobiography = []
if !member.get_autobiography_for_show.blank?
autobiography << {"key" => "#{member.get_autobiography_for_show.first[0].capitalize}", "value" => member.get_autobiography_for_show["autobiography"]}
end
image = member.get_image_for_show["img_src"]
{
"roles" => roles,
"plugins" => plugin_list, "plugins" => plugin_list,
"custom_fields_final" => custom_fields_final, "profile_data" => profile_data,
"role_fields_final" => role_fields_final,
"member_data" => data,
"autobiography_data" => autobiography,
"data" => { "data" => {
"img_src" => image, "image" => member.avatar.present? ? member.avatar.thumb.url : ActionController::Base.helpers.asset_path('member-pic.png'),
"name" => member.name "name" => member.name
} }
} }
end end
def personal_plugin def member_data(member, fields_to_show)
params = OrbitHelper.params profile_data = []
plugin_class = params[:plugin_name].constantize fields_to_show.each do |field|
plugin_value = plugin_class.find_by(uid: params[:uid]) case field['type']
data = [] when 'profile'
plugin_value.values_for_view.each do |key,value| field_data = member.get_attribute_data(field) rescue {}
data << {"key" => key.humanize, "value" => value} when 'custom'
if !field['id'].blank?
field_data = member.member_profile_field_values.find_by(:member_profile_field_id=>field['id'],:key=>field['key']).get_field_value rescue {}
else
field_data = member.member_profile_field_values.find_by(:key=>field['key']).get_field_value rescue {}
end end
{ when 'role'
"plugin_data" => data if !field['id'].blank?
} av = member.attribute_values.find_by(:attribute_field_id=>field['id'],:key=>field['key']) rescue nil
if !av.nil?
r = av.attribute_field.role rescue nil
if !r.nil?
if member.roles.include?(r)
field_data = av.get_field_value rescue {}
else
field_data = {}
end
else
field_data = {}
end
else
field_data = {}
end
else
av = member.attribute_values.find_by(:key=>field['key']) rescue nil
if !av.nil?
r = av.attribute_field.role rescue nil
if !r.nil?
if member.roles.include?(r)
field_data = av.get_field_value rescue {}
else
field_data = {}
end
else
field_data = {}
end
else
field_data = {}
end
end
end
next if field_data.blank? or field_data['value'].blank?
if field['sort_order']
field_data['sort_value'] = field_data['val'].blank? ? field_data['value'] : field_data['val']
field_data['sort_value'] = (field_data['sort_value'].is_i? ? field_data['sort_value'].to_i : field_data['sort_value'] rescue field_data['sort_value'])
end
if field['link_to_show']
field_data['value'] = "<a href='#{OrbitHelper.url_to_show(member.to_param)}'>#{field_data['value']}</a>"
end
if field['max_length']
field_data['value'] = (field_data['value'].length > field['max_length']) ? field_data['value'][0..field['max_length']]+'...' : field_data['value']
end
field_data['title_class'] = "member-data-title-"+field['key'].underscore.gsub('_','-')
field_data['value_class'] = "member-data-value-"+field['key'].underscore.gsub('_','-')
profile_data.push(field_data)
end
return profile_data
end end
end end

View File

@ -1,10 +1,10 @@
class OrbitAdminController < ApplicationController class OrbitAdminController < ApplicationController
include OrbitCoreLib::Authorize include OrbitCoreLib::Authorize
include OrbitCoreLib::PermissionUtility
include Authorize include Authorize
include OrbitBackendHelper include OrbitBackendHelper
before_action :authenticate_user, :log_user_action before_action :authenticate_user, :log_user_action, :load_authorized_categories
before_action :check_for_nil_categories, :only => [:new, :edit]
layout "back_end" layout "back_end"
def sort def sort
@ -16,14 +16,29 @@ class OrbitAdminController < ApplicationController
[:is_hidden,params[:order]]] [:is_hidden,params[:order]]]
when "category" when "category"
@sort = {:category_id=>params[:order]} @sort = {:category_id=>params[:order]}
when "title"
@sort = {:title=>params[:order]}
when "start_date" when "start_date"
@sort = {:postdate=>params[:order]} @sort = {:postdate=>params[:order]}
when "end_date" when "end_date"
@sort = {:deadline=>params[:order]} @sort = {:deadline=>params[:order]}
when "last_modified" when "last_modified"
@sort = {:update_user_id=>params[:order]} @sort = {:update_user_id=>params[:order]}
when "banner"
@sort = {'banner_id'=>params[:order]}
when "banner_name"
@sort = {:title=>params[:order]}
when "effect"
@sort = {:ad_fx=>params[:order]}
when "transition_interval"
@sort = {:timeout=>params[:order]}
when "transition_speed"
@sort = {:speed=>params[:order]}
when "size"
@sort = {:height=>params[:order]}
when "link"
@sort = {:out_link=>params[:order]}
else
s = Sanitize.clean(params[:sort]).to_sym
@sort = {s=>params[:order]}
end end
else else
@sort = {:created_at=>'desc'} @sort = {:created_at=>'desc'}
@ -50,4 +65,28 @@ class OrbitAdminController < ApplicationController
end end
end end
def search_data(data, fields)
if params[:keywords].present?
key_string = params[:keywords]
key_string = key_string.strip.nil? ? key_string : key_string.strip
keywords = key_string.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
regex = Regexp.union(keywords.map{|word| Regexp.new(".*"+word+".*", "i")})
data = data.any_of(fields.map{|f| {f.to_sym => regex} })
end
data
end
def load_authorized_categories
@user_authenticated_categories = current_user.is_admin? ? ["all"] : current_user.approved_categories.collect{|c| c.id} rescue []
@current_user_is_sub_manager = current_user.is_sub_manager?(@module_app) rescue false
end
def check_for_nil_categories
@user_authorized_categories = @module_app.categories.enabled.authorized(current_user)
if @current_user_is_sub_manager && @user_authorized_categories.blank?
render_403
end
end
end end

View File

@ -0,0 +1,43 @@
class OrbitGroupController < ApplicationController
layout "member"
before_action :authenticate_user, :get_group, :set_access_rights
def get_group
case params[:action]
when "show","edit"
uid = params[:id].split("-").last
@group = Group.find_by(:uid => uid)
when "newpost", "createpost", "members"
uid = params[:group_id].split("-").last
@group = Group.find_by(:uid => uid)
when "showpost", "editpost"
uid = params[:id].split("-").last
@post = GroupPost.find_by(:uid => uid)
@group = @post.group
end
end
def set_access_rights
@access_right_level = "none"
read_or_write = @group.permission rescue "read"
case params[:action]
when "show", "showpost", "newpost", "edit", "members", "editpost"
is_member = @group.users.include?(current_user)
if @group.admins.include?(current_user.id.to_s)
@access_right_level = "admin"
elsif is_member
if read_or_write == "write"
@access_right_level = "write"
elsif read_or_write == "read"
@access_right_level = "read"
end
elsif !is_member && @group.privacy == "open"
@access_right_level = "read"
end
end
end
def render_401
render "public/401"
end
end

View File

@ -1,6 +1,35 @@
class OrbitMemberController < ApplicationController class OrbitMemberController < ApplicationController
include OrbitBackendHelper include OrbitBackendHelper
before_action :authenticate_user before_action :authenticate_user, :check_aceess_rights, :set_module_app
layout "member" layout "member"
def check_aceess_rights
@user_has_privileges = false
if (current_user.is_admin? rescue false)
@user_has_privileges = true
else
visited_user = MemberProfile.find_by(:uid => params[:id].split("-").last).user.id rescue nil
visited_user = MemberProfile.find_by(:uid => params[:member_id].split("-").last).user.id if visited_user.nil? rescue nil
visited_user = MemberProfile.find_by(:uid => params[:uid]).user.id if visited_user.nil? rescue nil
visited_user = MemberProfile.find(params[:member_profile_id]).user.id if visited_user.nil? rescue nil
if (current_user.id == visited_user rescue false)
@user_has_privileges = true
elsif visited_user == nil && (params[:action] == "create" || params[:action] == "update")
@user_has_privileges = true
else
@user_has_privileges = false
end
end
end
def set_module_app
@module_app = ModuleApp.find_by_key("member")
end
def allow_admin_only
if !current_user.is_admin?
render_401
end
end
end end

View File

@ -5,6 +5,8 @@ class PagePartsController < ApplicationController
@part.sub_parts.build @part.sub_parts.build
@part_number = params[:part] @part_number = params[:part]
@page_id = params[:page_id] @page_id = params[:page_id]
page = Page.find(@page_id)
@child_page_count = (page.root? ? 0 : page.child_page.count) rescue 0
@modules = ModuleApp.widget_enabled @modules = ModuleApp.widget_enabled
@modules = @modules.concat(OrbitWidget.all) @modules = @modules.concat(OrbitWidget.all)
@no_orbit_bar = @no_side_bar = true @no_orbit_bar = @no_side_bar = true
@ -19,6 +21,8 @@ class PagePartsController < ApplicationController
@part = parts.where(:part_id => params[:id]).first @part = parts.where(:part_id => params[:id]).first
@part.sub_parts.build @part.sub_parts.build
@page_id = params[:page_id] @page_id = params[:page_id]
page = Page.find(@page_id)
@child_page_count = (page.root? ? 0 : page.child_page.count) rescue 0
@part_number = params[:id] @part_number = params[:id]
@select_number = @part.sub_parts.count @select_number = @part.sub_parts.count
@modules = ModuleApp.widget_enabled @modules = ModuleApp.widget_enabled
@ -31,30 +35,21 @@ class PagePartsController < ApplicationController
def edit_sub_part def edit_sub_part
@part = part_model.find(params[:part_id]) @part = part_model.find(params[:part_id])
@subpart = SubPart.find(params[:sub_part_id]) @subpart = SubPart.find(params[:sub_part_id])
@select_number = @part.sub_parts.index(@subpart) @select_number = @part.sub_parts.index{|sp| sp.id.to_s == @subpart.id.to_s}
@child_page_count = 0
@kind = @subpart.kind @kind = @subpart.kind
@modules = ModuleApp.widget_enabled @modules = ModuleApp.widget_enabled
@modules = @modules.concat(OrbitWidget.all) @modules = @modules.concat(OrbitWidget.all)
if @kind == "module_widget" if @kind == "module_widget"
@widget_types = []
module_name = @subpart.module module_name = @subpart.module
Dir.glob("#{Rails.root}/app/templates/#{@key}/modules/#{module_name.downcase}/*").each do |w| @widget_types = get_widget_files(module_name)
next if File.ftype(w).eql?("directory")
w = File.basename(w, ".*")
w = File.basename(w, ".*")
@widget_types << w.gsub("_","") if w != "index" && w != "show"
end
Dir.glob("#{Rails.root}/app/templates/#{@key}/widgets/#{module_name.downcase}/*").each do |w|
next if File.ftype(w).eql?("directory")
w = File.basename(w, ".*")
w = File.basename(w, ".*")
@widget_types << w.gsub("_","") if w != "index" && w != "show"
end
app = ModuleApp.find_by_key(module_name) rescue nil app = ModuleApp.find_by_key(module_name) rescue nil
app = OrbitWidget.find_by_key(module_name) if app.nil? app = OrbitWidget.find_by_key(module_name) if app.nil?
@categories = app.categories rescue [] @categories = app.categories.enabled rescue []
@widget_methods = app.get_registration.get_widget_methods @tags = app.tags rescue []
@widget_settings = app.get_registration.get_widget_settings @widget_methods = app.widget_methods
@widget_settings = app.widget_settings
@data_count = nil @data_count = nil
if !@widget_settings.blank? if !@widget_settings.blank?
@data_count = @widget_settings["data_count"] rescue nil @data_count = @widget_settings["data_count"] rescue nil
@ -93,6 +88,9 @@ class PagePartsController < ApplicationController
if final_params['categories'].nil? if final_params['categories'].nil?
final_params['categories'] = [] final_params['categories'] = []
end end
if final_params['tags'].nil?
final_params['tags'] = []
end
subpart.update_attributes(final_params) subpart.update_attributes(final_params)
end end
render :json => {"success"=>true}.to_json render :json => {"success"=>true}.to_json
@ -102,25 +100,15 @@ class PagePartsController < ApplicationController
module_name = params[:module] module_name = params[:module]
part = part_model.where(:part_id => params[:part_id], :page_id => params[:page_id]).first part = part_model.where(:part_id => params[:part_id], :page_id => params[:page_id]).first
@select_number = part.sub_parts.count rescue 0 @select_number = part.sub_parts.count rescue 0
@widget_types = [] @widget_types = get_widget_files(module_name)
Dir.glob("#{Rails.root}/app/templates/#{@key}/modules/#{module_name.downcase}/*").each do |w|
next if File.ftype(w).eql?("directory")
w = File.basename(w, ".*")
w = File.basename(w, ".*")
@widget_types << w.gsub("_","") if w != "index" && w != "show"
end
Dir.glob("#{Rails.root}/app/templates/#{@key}/widgets/#{module_name.downcase}/*").each do |w|
next if File.ftype(w).eql?("directory")
w = File.basename(w, ".*")
w = File.basename(w, ".*")
@widget_types << w.gsub("_","") if w != "index" && w != "show"
end
module_name = module_name.downcase.singularize module_name = module_name.downcase.singularize
app = ModuleApp.find_by_key(module_name) rescue nil app = ModuleApp.find_by_key(module_name) rescue nil
app = OrbitWidget.find_by_key(module_name) if app.nil? app = OrbitWidget.find_by_key(module_name) if app.nil?
@categories = app.categories rescue [] @categories = app.categories.enabled rescue []
@widget_methods = app.get_registration.get_widget_methods @tags = app.tags rescue []
@widget_settings = app.get_registration.get_widget_settings @widget_methods = app.widget_methods
@widget_settings = app.widget_settings
@data_count = nil @data_count = nil
if !@widget_settings.blank? if !@widget_settings.blank?
@data_count = @widget_settings["data_count"] rescue nil @data_count = @widget_settings["data_count"] rescue nil
@ -155,6 +143,7 @@ class PagePartsController < ApplicationController
def create def create
@part = part_model.new(part_params) @part = part_model.new(part_params)
@part.save! @part.save!
apply_to_sub_pages(part_params,nil,nil) if !params[:apply_to_subpage].nil? && !@part.page_id.nil?
render :json => {"success"=>true}.to_json render :json => {"success"=>true}.to_json
end end
@ -162,11 +151,79 @@ class PagePartsController < ApplicationController
def update def update
@part = part_model.find(params[:part_id]) @part = part_model.find(params[:part_id])
@part.update_attributes(part_params) @part.update_attributes(part_params)
apply_to_sub_pages(part_params,params[:part_id],params[:page_id]) if !params[:apply_to_subpage].nil? && !@part.page_id.nil?
render :json => {"success"=>true}.to_json render :json => {"success"=>true}.to_json
end end
private private
def apply_to_sub_pages(part_params,part_id=nil,page_id=nil)
page_id = part_params[:page_id] if page_id.nil?
page = Page.find(page_id) rescue nil
if !page.nil?
child_pages = page.child_page
child_pages.each do |cp|
temp = part_params
if part_id.nil?
partid = part_params[:part_id]
else
partid = part_model.find(part_id).part_id
end
page_part = cp.page_parts.where(:part_id => partid).first rescue nil
if page_part.nil?
temp[:page_id] = cp.id.to_s
part = part_model.new(temp)
part.save!
else
page_part.update_attributes(temp)
end
end
end
end
def get_widget_files(module_name)
temp = []
f = File.join("#{Rails.root}/app/templates/#{@key}/modules/#{module_name.downcase}/info.json")
if File.exists?f
info = File.read(f)
hash = JSON.parse(info) rescue {}
widgets = hash["widgets"] || []
widgets.each do |w|
w["thumbnail"] = "/assets/#{module_name.downcase}/thumbs/#{w["thumbnail"]}"
temp << w
end
end
if temp.empty?
Dir.glob("#{Rails.root}/app/templates/#{@key}/modules/#{module_name.downcase}/*").each do |w|
next if File.ftype(w).eql?("directory")
w = File.basename(w, ".*")
w = File.basename(w, ".*")
temp << w.gsub("_","") if w[0,1] == "_"
end
end
if temp.empty?
f = File.join("#{Rails.root}/app/templates/#{@key}/widgets/#{module_name.downcase}/info.json")
if File.exists?f
info = File.read(f)
hash = JSON.parse(info) rescue {}
widgets = hash["widgets"] || []
widgets.each do |w|
w["thumbnail"] = "/assets/#{module_name.downcase}/thumbs/#{w["thumbnail"]}"
temp << w
end
end
end
if temp.empty?
Dir.glob("#{Rails.root}/app/templates/#{@key}/widgets/#{module_name.downcase}/*").each do |w|
next if File.ftype(w).eql?("directory")
w = File.basename(w, ".*")
w = File.basename(w, ".*")
temp << w.gsub("_","") if w[0,1] == "_"
end
end
temp
end
def part_params def part_params
params.require(:page_part).permit! params.require(:page_part).permit!
end end

View File

@ -1,13 +1,14 @@
# pass the layout=false for not rendering the layouts and also can specify the methods to in the backend controller. # pass the layout=false for not rendering the layouts and also can specify the methods to in the backend controller.
# data-layout-content="arrayname" in layouts can be used to render data in the array # data-layout-content="arrayname" in layouts can be used to render data in the array
require 'zhconv' require 'zhconv'
require "uri"
class PagesController < ApplicationController class PagesController < ApplicationController
before_action :get_key before_action :get_key
layout :get_layout layout :get_layout
include PagesHelper include PagesHelper
before_filter :check_frontend_open, :only => [:home,:show] before_filter :check_frontend_open, :only => [:home,:show]
before_filter :check_authorization, :except => [:home,:show] before_filter :check_authorization, :except => [:home,:show]
before_filter :set_edit_mode
def index def index
@pages = Page.all @pages = Page.all
@ -17,8 +18,6 @@ class PagesController < ApplicationController
def edit_view def edit_view
@manifest = @key @manifest = @key
@dataApi = "edit" @dataApi = "edit"
# @qq = render_to_string(:partial => @p, :layout => false)
view = get_view view = get_view
if File.exists?(view) if File.exists?(view)
render view render view
@ -27,22 +26,23 @@ class PagesController < ApplicationController
def home def home
@manifest = @key @manifest = @key
@dataApi = nil
page = Page.first page = Page.first
Thread.new do
impressionist(page) impressionist(page)
OrbitHelper.set_params params page.inc(view_count: 1)
OrbitHelper.set_site_locale locale
final_page = render_final_page("home",page,true)
if session[:zh_cn]
final_page = ZhConv.convert("zh-cn", final_page)
final_page.gsub!('/zh_tw/','/zh_cn/')
end end
render :html => final_page.html_safe params[:is_frontend_view] = "true"
OrbitHelper.set_params params,current_user
OrbitHelper.set_site_locale locale
OrbitHelper.set_request_object request
OrbitHelper.render_meta_tags []
render :html => render_final_page("home",page,true).html_safe
end end
def show def show
display_type = "" display_type = ""
path = request.path.split('/') path = request.path.split('/')
params[:is_frontend_view] = "true"
if path.size <= 2 if path.size <= 2
redirect_to root_path redirect_to root_path
else else
@ -66,20 +66,51 @@ class PagesController < ApplicationController
end end
page = Page.find_by_param(params[:page_id]) page = Page.find_by_param(params[:page_id])
if !page.nil? if !page.nil?
if !page.enabled_for_mobile && !$mobile.blank?
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => :not_found
return
end
if page.enabled_for.include? I18n.locale.to_s if page.enabled_for.include? I18n.locale.to_s
if page.page_type == "link"
redirect_to page.external_url
return
end
module_app = page.module.downcase.pluralize module_app = page.module.downcase.pluralize
params[:target_controller] = "#{module_app}" params[:target_controller] = "#{module_app}"
if display_type == "index" if display_type == "index"
params[:layout_type] = params[:method] || page.layout || "index" params[:layout_type] = params[:method] || page.layout || "index"
end end
params[:url] = page.url params[:url] = page.url
categories = []
if page.module == "member"
if page.categories.first == "all"
categories = ["all"]
else
page.categories.each do |c|
category = Role.find(c) rescue nil
if !category.nil? && !category.disabled
categories << c
end
end
end
else
page.categories.each do |c|
category = Category.find(c) rescue nil
if !category.nil? && !category.disable
categories << c
end
end
categories = ["all"] if categories.blank?
end
@manifest = @key @manifest = @key
@dataApi = nil OrbitHelper.set_params params,current_user
OrbitHelper.set_params params OrbitHelper.set_request_object request
OrbitHelper.set_site_locale locale OrbitHelper.set_site_locale locale
OrbitHelper.set_this_module_app module_app.singularize OrbitHelper.set_this_module_app module_app.singularize
OrbitHelper.set_page_categories page.categories || [] OrbitHelper.set_page_categories categories || ["all"]
OrbitHelper.set_page_tags page.tags || []
OrbitHelper.set_page_role_status page.role_status || []
OrbitHelper.set_member_sort_position page.member_sort_position
OrbitHelper.set_page_data_count page.data_count OrbitHelper.set_page_data_count page.data_count
if params[:layout].kind_of?(String) if params[:layout].kind_of?(String)
layout = to_bool(params[:layout]) layout = to_bool(params[:layout])
@ -87,15 +118,17 @@ class PagesController < ApplicationController
layout = true layout = true
end end
Thread.new do
impressionist(page) impressionist(page)
final_page = render_final_page("#{module_app}/#{params[:target_action]}",page,layout) page.inc(view_count: 1)
if session[:zh_cn]
final_page = ZhConv.convert("zh-cn", final_page)
final_page.gsub!('/zh_tw/','/zh_cn/')
end end
render :html => final_page.html_safe render :html => render_final_page("#{module_app}/#{params[:target_action]}",page,layout).html_safe
else else
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => :not_found if Site.first.enable_redirect_index
redirect_to root_url
else
render :file => "#{Rails.root}/public/411.html", :layout => false, :status => :not_found
end
end end
else else
render :file => "#{Rails.root}/public/404.html", :layout => false, :status => :not_found render :file => "#{Rails.root}/public/404.html", :layout => false, :status => :not_found
@ -103,6 +136,17 @@ class PagesController < ApplicationController
end end
end end
def update_child_pages_url(page)
page.child_page.each do |cp|
if !cp.child_page.blank?
update_child_pages_url(cp)
else
cp.url = page.url + "/#{cp.page_id}"
cp.save
end
end
end
def update_item_position def update_item_position
@page = Page.find(params[:id]) @page = Page.find(params[:id])
new_parent_page = Page.find(params[:parent_id]) new_parent_page = Page.find(params[:parent_id])
@ -111,6 +155,9 @@ class PagesController < ApplicationController
if new_parent_page.id != old_parent_page_id if new_parent_page.id != old_parent_page_id
url = (new_parent_page.url == "/" ? "" : new_parent_page.url) url = (new_parent_page.url == "/" ? "" : new_parent_page.url)
@page.url = url + "/#{@page.page_id}" @page.url = url + "/#{@page.page_id}"
if !@page.child_page.blank?
update_child_pages_url(@page)
end
end end
@page.save @page.save
params["children_ids"].each_with_index do |child,i| params["children_ids"].each_with_index do |child,i|
@ -122,7 +169,13 @@ class PagesController < ApplicationController
if new_parent_page.id != old_parent_page_id if new_parent_page.id != old_parent_page_id
old_parent_page = Page.find(old_parent_page_id) old_parent_page = Page.find(old_parent_page_id)
old_parent_page.child_page.each_with_index do |page,i| # old_parent_page.child_page.each_with_index do |page,i|
# page.number = i
# page.save
# end
params["parent_children_ids"] = params["parent_children_ids"] || []
params["parent_children_ids"].each_with_index do |child, i|
page = Page.find(child)
page.number = i page.number = i
page.save page.save
end end
@ -136,41 +189,122 @@ class PagesController < ApplicationController
def destroy def destroy
page = Page.find(params[:id]) page = Page.find(params[:id])
@parent_pages = page.parent_pages_without_root
page.destroy page.destroy
respond_to do |format| respond_to do |format|
format.js format.js
end end
end end
def get_member_attributes
@page_id = params[:page_id]
@selected_attribs = Page.find(@page_id).custom_array_field
@selected_attribs = [
{"key"=>"name", "type"=>"profile","sort_order"=>2,"link_to_show"=>true, "human_readable" => I18n.t("users.name")},
{"key"=>"email", "type"=>"profile", "human_readable" => I18n.t("users.email")},
{"key"=>"office_tel", "type"=>"profile", "human_readable" => I18n.t("users.office_tel")}
] if @selected_attribs.blank?
personal_attribs = [
{"key" => "first_name", "human_readable" => I18n.t("users.first_name")},
{"key" => "last_name", "human_readable" => I18n.t("users.last_name")},
{"key" => "name", "human_readable" => I18n.t("users.name")},
{"key" => "sex", "human_readable" => I18n.t("users.sex")},
{"key" => "office_tel", "human_readable" => I18n.t("users.office_tel")},
{"key" => "birthday", "human_readable" => I18n.t("users.birthday")},
{"key" => "address", "human_readable" => I18n.t("users.address")},
{"key" => "personal_website", "human_readable" => I18n.t("users.personal_website")},
{"key" => "autobiography", "human_readable" => I18n.t("users.autobiography")},
{"key" => "email", "human_readable" => I18n.t("users.email")}
]
custom_attribs = MemberProfileField.all.asc(:created_at).collect do |mpf|
{"key" => mpf.key, "human_readable" => mpf.title}
end
role_attribs = AttributeField.all.asc(:created_at).collect do |af|
{"key" => af.key, "human_readable" => af.title}
end
@attribs = {
"profile" => personal_attribs,
"custom" => custom_attribs,
"role" => role_attribs,
"types" =>[
{"key" => "profile", "human_readable" => "Profile"},
{"key" => "custom", "human_readable" => "Custom"},
{"key" => "role", "human_readable" => "Role"}
]
}
render :partial => "member_frontend_field"
end
def save_member_frontend_fields
fields = params["fields"]
array = []
fields.each do |field|
array << field.last
end
page = Page.find(params[:page_id])
page.custom_array_field = array
page.save
render :json => {"success" => true}.to_json
end
def get_categories def get_categories
module_app = ModuleApp.find_by_key(params[:module]); module_app = ModuleApp.find_by_key(params[:module]);
if module_app.key.eql?("member") if module_app.key.eql?("member")
@categories = module_app.role_status.collect do |cat| roles = Role.order_by(:_id=>'ASC').all.collect do |role|
{ {
"title" => "#{cat.title} (#{cat.role.title})", "title" => role.title,
"id" => cat.id.to_s "id" => role.id.to_s,
"status" => RoleStatus.where(:role=>role).collect do |status|
{
"title" => status.title,
"id" => status.id.to_s
}
end
} }
end end
else else
@categories = module_app.categories.collect do |cat| if !module_app.key.eql?("page_content")
categories = module_app.categories.enabled.collect do |cat|
{ {
"title" => cat.title, "title" => cat.title,
"id" => cat.id.to_s "id" => cat.id.to_s
} }
end end
tags = module_app.tags.collect do |t|
{
"name" => t.name,
"id" => t.id.to_s
}
end
else
categories = []
tags = []
end
end end
roles = roles.nil? ? [] : roles
categories = categories.nil? ? [] : categories
tags = tags.nil? ? [] : tags
if module_app.data_count.nil? if module_app.data_count.nil?
render :json => {"categories" => @categories,"layouts" => (get_layouts module_app.key),"data_count" => {"present"=>false}}.to_json render :json => {"categories" => categories, "tags" => tags,"roles" => roles,"layouts" => (get_layouts module_app.key),"data_count" => {"present"=>false}, "locale" => I18n.locale.to_s}.to_json
else else
render :json => {"categories" => @categories,"layouts" => (get_layouts module_app.key),"data_count" => {"present"=>true,"start"=>module_app.data_count.begin, "end" => module_app.data_count.end}}.to_json render :json => {"categories" => categories, "tags" => tags,"roles" => roles,"layouts" => (get_layouts module_app.key),"data_count" => {"present"=>true,"start"=>module_app.data_count.begin, "end" => module_app.data_count.end}, "locale" => I18n.locale.to_s}.to_json
end end
end end
def new def new
@page = Page.new @page = Page.new(
:enabled_for_mobile=>true,
:menu_enabled_for=>["en", "zh_tw"],
:enabled_for=>["en", "zh_tw"],
:enabled_for_sitemap=>["en", "zh_tw"]
)
@pages = Page.where(:page_id.ne => "" , :page_id.exists => true) @pages = Page.where(:page_id.ne => "" , :page_id.exists => true)
@modules = ModuleApp.all.frontend_enabled @modules = ModuleApp.all.frontend_enabled.order_by(:key=>'asc')
end end
@ -180,11 +314,21 @@ class PagesController < ApplicationController
@pages = Page.where(:page_id.ne => "" , :page_id.exists => true) @pages = Page.where(:page_id.ne => "" , :page_id.exists => true)
@modules = ModuleApp.all.frontend_enabled @modules = ModuleApp.all.frontend_enabled
@module_app = ModuleApp.find_by_key(@page.module) rescue nil @module_app = ModuleApp.find_by_key(@page.module) rescue nil
@categories = @module_app.categories rescue [] @categories = @module_app.categories.enabled rescue []
if @module_app.key.eql?("page_content")
@categories = []
end
@tags = @module_app.tags rescue []
if @module_app.key.eql?("member") if @module_app.key.eql?("member")
@status = @module_app.role_status rescue [] @roles = Role.order_by(:_id=>'ASC').all.collect do |role|
{
"title" => role.title,
"id" => role.id.to_s,
"status" => RoleStatus.where(:role=>role)
}
end
else else
@status = [] @roles = []
end end
@layout_types = get_layouts @module_app.key @layout_types = get_layouts @module_app.key
end end
@ -194,6 +338,7 @@ class PagesController < ApplicationController
@page = Page.find(params[:id]) @page = Page.find(params[:id])
@page.update_attributes(page_update_params) @page.update_attributes(page_update_params)
@page.save @page.save
@parent_pages = @page.parent_pages_without_root
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -204,6 +349,7 @@ class PagesController < ApplicationController
params['page']['page_id'] = params['page']['page_id'].gsub('-','_') params['page']['page_id'] = params['page']['page_id'].gsub('-','_')
@page = Page.new(page_params) @page = Page.new(page_params)
@page.save! @page.save!
@parent_pages = @page.parent_pages_without_root
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -213,42 +359,71 @@ class PagesController < ApplicationController
def get_layouts(module_app) def get_layouts(module_app)
layout_types = [] layout_types = []
f = File.join("#{Rails.root}/app/templates/#{@key}/modules/#{module_app}/info.json")
if File.exists?f
info = File.read(f)
hash = JSON.parse(info) rescue {}
frontends = hash["frontend"] || []
frontends.each do |frontend|
frontend["thumbnail"] = "/assets/#{module_app}/thumbs/#{frontend["thumbnail"]}"
layout_types << frontend
end
end
if layout_types.empty?
Dir.glob("#{Rails.root}/app/templates/#{@key}/modules/#{module_app}/*").each do |w| Dir.glob("#{Rails.root}/app/templates/#{@key}/modules/#{module_app}/*").each do |w|
next if File.ftype(w).eql?("directory") next if File.ftype(w).eql?("directory")
w = File.basename(w, ".*") w = File.basename(w, ".*")
w = File.basename(w, ".*") w = File.basename(w, ".*")
if w[0,1] != "_" && w[0,1] != "s" if w[0,1] != "_" && w[0,1] != "s" && w != "info"
layout_types << w layout_types << w
end end
end end
end
layout_types layout_types
end end
def render_final_page(original_view=get_view,page,layout) def render_final_page(original_view=get_view,page,layout)
final_html_for_render = ""
OrbitHelper.set_css_to_render_to_empty
if layout if layout
parts = $mobile.blank? ? (page.page_parts rescue []) : (page.mobile_page_parts rescue []) parts = $mobile.blank? ? (page.page_parts rescue []) : (page.mobile_page_parts rescue [])
@part_partials = {} @part_partials = {}
parts.each do |part| parts.each do |part|
subparts = part.sub_parts.asc(:created_at) subparts = part.sub_parts.asc(:created_at)
partials = [] partials = []
subparts.each do |subpart| subparts.each do |subpart|
if subpart.kind == "module_widget" if subpart.kind == "module_widget"
OrbitHelper.set_current_widget subpart
OrbitHelper.set_widget_data_count subpart.data_count OrbitHelper.set_widget_data_count subpart.data_count
OrbitHelper.set_widget_categories subpart.categories
OrbitHelper.set_widget_module_app subpart.module OrbitHelper.set_widget_module_app subpart.module
OrbitHelper.set_widget_item_url subpart OrbitHelper.set_widget_item_url subpart
OrbitHelper.render_meta_tags []
OrbitHelper.set_widget_title subpart.title OrbitHelper.set_widget_title subpart.title
OrbitHelper.set_widget_categories subpart.categories || ["all"]
OrbitHelper.set_widget_tags subpart.tags || []
custom_value = subpart.custom_string_field || subpart.custom_array_field rescue nil custom_value = subpart.custom_string_field || subpart.custom_array_field rescue nil
if !custom_value.nil? if !custom_value.nil?
OrbitHelper.set_widget_custom_value custom_value OrbitHelper.set_widget_custom_value custom_value
end end
partials << render_widget_for_frontend(subpart.module,subpart.widget_method,subpart.widget_type) if @editmode
partials << "<div class='editmode-ps' title='#{subpart.module}'> " + render_widget_for_frontend(subpart.module,subpart.widget_method,subpart.widget_type,subpart.id.to_s) + "<a href='/page_parts/edit_sub_part?page_id=#{page.id.to_s}&part_id=#{part.id.to_s}&sub_part_id=#{subpart.id.to_s}#{(!$mobile.blank? ? '&mobile_view=1' : '')}'> </a></div>"
else
# widget_html = Rails.cache.fetch("subpart_#{subpart.module}_#{subpart.id.to_s}_"+I18n.locale.to_s,{ race_condition_ttl: 2, expires_in: 5.minutes}) do
# render_widget_for_frontend(subpart.module,subpart.widget_method,subpart.widget_type,subpart.id.to_s)
# end
widget_html = render_widget_for_frontend(subpart.module,subpart.widget_method,subpart.widget_type,subpart.id.to_s)
partials << widget_html
end
elsif subpart.kind == "text" elsif subpart.kind == "text"
if @editmode
partials << "<div class='editmode-ps' title='text'> " + subpart.content + "<a href='/page_parts/edit_sub_part?page_id=#{part.page_id.to_s}&part_id=#{part.id.to_s}&sub_part_id=#{subpart.id.to_s}#{(!$mobile.blank? ? '&mobile_view=1' : '')}'> </a></div>"
else
partials << subpart.content partials << subpart.content
end end
end end
end
@part_partials["data-pp='#{part.part_id}'"] = partials @part_partials["data-pp='#{part.part_id}'"] = partials
end end
@ -261,12 +436,14 @@ class PagesController < ApplicationController
end end
@layout_html = render_to_string(@file) @layout_html = render_to_string(@file)
doc = Nokogiri::HTML(@layout_html, nil, "UTF-8") doc = Nokogiri::HTML(@layout_html, nil, "UTF-8")
head = doc.css("head")
@part_partials.each do |key, partial| @part_partials.each do |key, partial|
html_string = "" html_string = ""
partial.each do |p| partial.each do |p|
if !p.nil?
html_string = html_string + p html_string = html_string + p
end end
end
pp = doc.css("*[#{key}]") pp = doc.css("*[#{key}]")
if !pp.blank? if !pp.blank?
pp = pp[0] pp = pp[0]
@ -274,16 +451,52 @@ class PagesController < ApplicationController
end end
end end
if @editmode
pps = doc.css("*[data-pp]")
pps.each do |pp|
number = pp.attributes["data-pp"].value
if pp.inner_html.strip == ""
pp.inner_html = "<a href='/page_parts/new?part=#{number}&page_id=#{page.id.to_s}#{(!$mobile.blank? ? '&mobile_view=1' : '')}'> </a>"
else
inner_html = pp.inner_html
pp.inner_html = inner_html + "<a href='/page_parts/#{number}/edit?page_id=#{page.id.to_s}#{(!$mobile.blank? ? '&mobile_view=1' : '')}'> </a>"
end
end
end
if original_view != "home" if original_view != "home"
viewarea = doc.css("*[data-content='true']")[0] viewarea = doc.css("*[data-content='true']")[0]
viewarea.inner_html = render_to_string(original_view) viewarea.inner_html = render_to_string(original_view) rescue "<div></div>"
head[0].inner_html = OrbitHelper.meta_tags_html + head.inner_html
end end
head[0].inner_html = head.inner_html + OrbitHelper.get_css_to_render_in_head
link = doc.css("link")[0] link = doc.css("link")[0]
link.attributes["href"].value = current_site.favicon.url.nil? ? "/assets/favicon.ico" : current_site.favicon.url link.attributes["href"].value = current_site.favicon.url.nil? ? "/assets/favicon.ico" : current_site.favicon.url
doc.to_html final_html_for_render = doc.to_html
else else
render_to_string(original_view) final_html_for_render = render_to_string(original_view) rescue "<div></div>"
end
final_html_for_render = change_to_language(final_html_for_render)
if @editmode
session[:mobile] = $temp_mobile
end
format_date(final_html_for_render,(original_view == "home" ? "home" : page.module)) rescue final_html_for_render
end
def format_date(html,module_key)
doc = Nokogiri::HTML(html, nil, "UTF-8")
doc.css("body").first.set_attribute("data-module",module_key) rescue nil
dates = doc.css("*[date-format]")
if dates.blank?
return doc.to_html
else
dates.each do |d|
format = d.attributes["date-format"].value
date = DateTime.parse(d.inner_text)
d.inner_html = d.inner_html.gsub(d.inner_text.strip, " " + date.strftime(format))
end
return doc.to_html
end end
end end
@ -305,15 +518,32 @@ class PagesController < ApplicationController
page = Page.find(params[:page][:parent_page]) page = Page.find(params[:page][:parent_page])
page.url = page.url == "/" ? "" : page.url page.url = page.url == "/" ? "" : page.url
@url = page.url + "/#{params[:page][:page_id]}" @url = page.url + "/#{params[:page][:page_id]}"
p = params.require(:page).permit(:number, :page_type, :page_id, :module, :layout, :parent_page, :data_count, enabled_for_sitemap: [], enabled_for: [], menu_enabled_for: [], categories: [], name_translations: [:en, :zh_tw],external_url_translations: [:en, :zh_tw]) valid_locales = current_site.valid_locales rescue []
p = params.require(:page).permit(:number, :page_type, :page_id, :module, :layout, :parent_page, :data_count, :enabled_for_mobile, :member_sort_position, enabled_for_sitemap: [], enabled_for: [], menu_enabled_for: [], categories: [], tags: [], role_status: [], name_translations: valid_locales ,external_url_translations: valid_locales)
p["url"] = @url p["url"] = @url
if p["external_url_translations"]
current_site.in_use_locales.each do |loc|
p["external_url_translations"][loc.to_s] = p["external_url_translations"][loc.to_s].sub("http://" + request.host_with_port,"") if p["external_url_translations"][loc.to_s].present?
end
end
p p
end end
def page_update_params def page_update_params
p = params.require(:page).permit(:number, :page_type, :page_id, :module, :layout, :parent_page, :data_count, enabled_for_sitemap: [], enabled_for: [],menu_enabled_for: [], categories: [], name_translations: [:en, :zh_tw], external_url_translations: [:en, :zh_tw]) valid_locales = current_site.valid_locales rescue []
p = params.require(:page).permit(:number, :page_type, :page_id, :module, :layout, :parent_page, :data_count, :enabled_for_mobile, :member_sort_position, enabled_for_sitemap: [], enabled_for: [],menu_enabled_for: [], categories: [], tags: [], role_status: [], name_translations: valid_locales, external_url_translations: valid_locales)
p["role_status"] = p["role_status"] || []
p["categories"] = p["categories"] || []
p["tags"] = p["tags"] || []
p["enabled_for"] = p["enabled_for"] || [] p["enabled_for"] = p["enabled_for"] || []
p["menu_enabled_for"] = p["menu_enabled_for"] || [] p["menu_enabled_for"] = p["menu_enabled_for"] || []
p["enabled_for_sitemap"] = p["enabled_for_sitemap"] || []
p["enabled_for_mobile"] = p["enabled_for_mobile"] || 0
if p["external_url_translations"]
current_site.in_use_locales.each do |loc|
p["external_url_translations"][loc.to_s] = p["external_url_translations"][loc.to_s].sub("http://" + request.host_with_port,"") if p["external_url_translations"][loc.to_s].present?
end
end
p p
end end
@ -348,4 +578,24 @@ class PagesController < ApplicationController
end end
end end
def set_edit_mode
@dataApi = "frontend"
@editmode = false
if !current_user.nil? and current_user.is_admin?
if params[:editmode] == "on"
@editmode = true
@dataApi = "edit"
end
end
end
def change_to_language(final_html)
if session[:zh_cn]
final_html = ZhConv.convert("zh-cn", final_html,false)
final_html.gsub!('/zh_tw/','/zh_cn/')
final_html.sub!('<a href="'+request.path+'">繁体中文</a>','<a href="'+(request.path.sub('/zh_cn/','/zh_tw/'))+'">繁体中文</a>')
end
final_html
end
end end

View File

@ -2,30 +2,108 @@ class SessionsController < ApplicationController
layout "authentication" layout "authentication"
def new def new
if session[:user_id]
redirect_to admin_dashboards_path
end
end end
def create def create
user = User.find_by(user_name: params[:user_name]) rescue nil user = User.find_by(user_name: params[:user_name]) rescue nil
if (user && user.authenticate(params[:password]) && user.is_confirmed?.eql?(true)) if (user && user.authenticate(params[:password]) && user.is_confirmed?.eql?(true))
if user.is_approved? # if user.is_approved? || user.is_admin?
session[:user_id] = user.id session[:user_id] = user.id
redirect_to admin_dashboards_path, :notice => "Logged in!" session[:login_referer] = nil
elsif user.is_admin? if params[:referer_url]
session[:user_id] = user.id redirect_to URI.parse(params[:referer_url]).path
redirect_to admin_dashboards_path, :notice => "Logged in!"
else else
flash.now.alert = "User not approved." redirect_to admin_dashboards_path
render "new"
end end
# else
# flash.now.alert = "User not approved."
# render "new"
# end
else else
flash.now.alert = "Invalid username or password" flash.now.alert = "Invalid username or password"
render "new" render "new"
end end
end end
def google_result
@code = params[:code]
if @code.nil?
redirect_to root_url
end
end
def google_callback
error = params[:error] rescue nil
if error == "access_denied"
redirect_to auth_failure_path and return
end
auth = env["omniauth.auth"]
user = Google.find_by("google_uid" => auth.uid).user rescue nil
if user.nil? && current_user.nil?
user_connected = false
else
user_connected = true
if user.nil? && !current_user.nil?
connection_successful = connect_account(auth)
else
if login_user(user,auth)
if params[:referer_url]
redirect_to URI.parse(params[:referer_url]).path and return
else
redirect_to admin_dashboards_path and return
end
end
end
end
if user_connected && connection_successful
code = 1
elsif user_connected && !connection_successful
code = 2
else !user_connected && !connection_successful
code = 3
end
redirect_to auth_google_result_path(:code => code)
end
def google_remove
current_user.google.destroy rescue ""
redirect_to admin_member_path(current_user.member_profile.to_param) and return
end
def google_faliure
@code = 2
render "google_result"
end
def connect_account(auth)
if !current_user.nil?
google = Google.new
google.google_uid = auth.uid
google.token = auth.credentials.token
google.connected = true
google.save
current_user.google = google
current_user.save
return true
else
return false
end
end
def login_user(user,auth)
if user.google.token != auth.credentials.token
user.google.token = auth.credentials.token
user.google.save
end
session[:user_id] = user.id
end
def destroy def destroy
log_user_action log_user_action
session[:user_id] = nil session[:user_id] = nil
redirect_to root_url, :notice => "Logged out!" redirect_to root_url
end end
end end

View File

@ -1,14 +1,41 @@
class SitemapsController < ApplicationController class SitemapsController < ApplicationController
# caches_page :sitemap_xml
def index def index
genrate_sitemap
end
def sitemap_xml
@items = Page.where(:id.ne => Page.root.id).asc(:number)
@home = Page.root
respond_to do |format|
format.xml
end
end
private
def genrate_sitemap
if $mobile.blank?
pages = Page.root.child_pages_enabled_for_sitemap pages = Page.root.child_pages_enabled_for_sitemap
else
pages = Page.root.child_pages_enabled_for_sitemap_for_mobile
end
def create_json(pages) def create_json(pages)
item = {} item = {}
pages.each do |page| pages.each do |page|
if page.child_page.size > 0 if page.child_page.size > 0
if page.page_type == "page" if page.page_type == "page"
if $mobile.blank?
item["#{page.name}"] = {"url"=> "/#{locale.to_s}" + page.url, "children"=>create_json(page.sorted_published_child_pages), "target"=>"_self"} item["#{page.name}"] = {"url"=> "/#{locale.to_s}" + page.url, "children"=>create_json(page.sorted_published_child_pages), "target"=>"_self"}
else else
item["#{page.name}"] = {"url"=> "/#{locale.to_s}" + page.url, "children"=>create_json(page.sorted_published_child_pages_for_mobile), "target"=>"_self"}
end
else
if $mobile.blank?
item["#{page.name}"] = {"url"=> page.external_url, "children"=>create_json(page.sorted_published_child_pages), "target"=>"_blank"} item["#{page.name}"] = {"url"=> page.external_url, "children"=>create_json(page.sorted_published_child_pages), "target"=>"_blank"}
else
item["#{page.name}"] = {"url"=> page.external_url, "children"=>create_json(page.sorted_published_child_pages_for_mobile), "target"=>"_blank"}
end
end end
else else
if page.page_type == "page" if page.page_type == "page"
@ -23,4 +50,6 @@ class SitemapsController < ApplicationController
items = create_json(pages) items = create_json(pages)
items items
end end
end end

View File

@ -0,0 +1,111 @@
require "net/http"
require 'open-uri'
require 'zip/zip'
class StoreApiController < ApplicationController
def confirmation
site_token = params[:site_token]
store_token = params[:store_token]
puts current_site.to_s
if current_site.uid.eql?(site_token)
current_site.store_token = store_token
current_site.save
render :json => {"success" => true}.to_json
else
render :json => {"success" => false}.to_json
end
end
def install_module
if current_site.store_token.nil?
response = {"success" => false}
elsif current_site.store_token == params[:site_token]
file = File.join(Rails.root,"downloaded_extensions.rb")
g = "gem '#{params[:module_key]}', git: '#{params[:git_path]}'"
File.open(file,"a+") { |f| f.puts(g) }
if !directory_exists?(File.join(Rails.root,"app","templates","#{Site.first.template}","modules","#{params[:module_key]}"))
download_template(params[:template],params[:template_filename])
end
response = {"success" => true}
else
response = {"success" => false}
end
render :json => response.to_json
if response["success"]
bundle_install
# give_permissions(params[:module_key])
end
end
def uninstall_module
file = File.join(Rails.root,"downloaded_extensions.rb")
data = File.read(file)
g = "gem '#{params[:module_key]}', git: '#{params[:git_path]}'\n"
data = data.gsub(g,"")
File.write(file,data)
bundle_install
render :json => {"success" => true}.to_json
end
def render_license_denied
render :layout => "back_end"
end
# this is for feed module.
def get_channel_lists
apps = ModuleApp.where(:feeds_url.ne => nil)
channels = []
if apps.count > 0
apps.each do |app|
channel = {}
channel["title"] = app.title
channel["key"] = app.key
channel["url"] = app.feeds_url
channel["app_icon"] = app.get_registration.get_side_bar.get_icon_class
channels << channel
end
end
render :json => {"channels" => channels}.to_json
end
private
def bundle_install
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=downloaded_extensions.rb bundle update && bundle` }
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
sleep 5
end
def restart_server_after_install
%x(kill -s USR2 `cat tmp/pids/unicorn.pid`)
sleep 5
end
def download_template(url,name)
dir = File.join(Rails.root,"public","template_cache")
destination = File.join(Rails.root,"app","templates","#{Site.first.template}","modules")
if !directory_exists?(dir)
Dir.mkdir dir
end
zipfile = File.join(Rails.root, "public" , "template_cache", name)
open(zipfile, 'wb') do |fo|
fo.print open(url).read
end
unzip_file(zipfile,destination)
end
def directory_exists?(directory)
File.directory?(directory)
end
def unzip_file (file, destination)
Zip::ZipFile.open(file) { |zip_file|
zip_file.each { |f|
f_path=File.join(destination, f.name)
FileUtils.mkdir_p(File.dirname(f_path))
zip_file.extract(f, f_path) unless File.exist?(f_path)
}
}
FileUtils.rm_rf(File.join(Rails.root,"public","template_cache"))
end
end

View File

@ -1,6 +1,5 @@
module Admin::AttributeValuesViewHelper module Admin::AttributeValuesViewHelper
OPT = [ OPT = [
["YYYY / MM / DD hh : mm","format1"],
["YYYY / MM / DD","format2"], ["YYYY / MM / DD","format2"],
["YYYY / MM","format3"], ["YYYY / MM","format3"],
["YYYY","format4"] ["YYYY","format4"]

View File

@ -0,0 +1,35 @@
module Admin::GroupsHelper
def remote_file_exists?(url)
url = URI.parse(url)
Net::HTTP.start(url.host, url.port) do |http|
return http.head(url.request_uri)['Content-Type'].start_with? 'image'
end
end
def parse_for_images(content)
urls = URI.extract(content)
images = []
urls.each do |url|
images << url if !url.nil? && remote_file_exists?(url)
end if !urls.empty?
image_content = "<br />"
images.each do |img|
content = content.sub(img,"")
image_content = image_content + "<img src='#{img}' style='width:auto;' /><br />"
end if !images.empty?
return [content, image_content]
end
def is_user_group_admin?
return (@access_right_level == "admin" ? true : false)
end
def user_can_write?
return (@access_right_level == "admin" || @access_right_level == "write" ? true : false)
end
def user_can_read?
return (@access_right_level == "admin" || @access_right_level == "write" || @access_right_level == "read" ? true : false)
end
end

View File

@ -0,0 +1,68 @@
module Admin::ModuleStoreHelper
def get_built_in_extensions
built_in_extensions = []
extensions_to_update = get_extensions_to_update
@extensions_to_update_count = extensions_to_update.count
built_in_extensions = get_extension_from_file("built_in",extensions_to_update)
built_in_extensions.concat(get_extension_from_file("downloaded",extensions_to_update))
return built_in_extensions
end
def get_extension_from_file(type,extensions_to_update)
temp = []
extensions = File.new("#{Rails.root}/#{type}_extensions.rb", "r")
while (extension = extensions.gets)
is_extension = extension.start_with?("gem")
extension = extension.split(',')
if is_extension
key = extension[0].split(/[\'\"]/)[1]
ma = ModuleApp.find_by_key(key) rescue nil
if !ma.nil?
update_available = extensions_to_update.include?(key) ? true : false
temp << {'key' => key, 'name' => ma.title, 'repo' => extension[1].split(/[\'\"]/)[1], 'tag' => (extension[2].split(/[\'\"]/)[1] rescue ""), "update_available" => update_available, "type" => type}
end
end
end
return temp
end
def get_extensions_to_update
# if !File.exists?("#{Rails.root}/built_in_extensions.rb.lock") || !File.exists?("#{Rails.root}/downloaded_extensions.rb.lock")
# update_extension_file("built_in")
# update_extension_file("downloaded")
# return []
# else
# update_extensions = get_update_info_for_extensions("built_in")
# update_extensions.concat(get_update_info_for_extensions("downloaded"))
# return update_extensions
# end
update_extensions = get_update_info_for_extensions("built_in")
return update_extensions
end
def update_extension_file(type)
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=#{type}_extensions.rb bundle update && bundle` }
end
def get_update_info_for_extensions(type)
buffer = Bundler.with_clean_env { `cd #{Rails.root} && bundle outdated` }
buffer = buffer.split("\n")
if buffer.last == "Bundle up to date!"
return []
elsif buffer.first.start_with?("The git source")
update_extension_file(type)
return []
else
output = []
buffer.each do |b|
if b.start_with?(" * ")
temp = b.split(" ")
output << temp[1] if !temp[1].nil?
end
end
return output
end
end
end

View File

@ -16,16 +16,20 @@ module ApplicationHelper
end end
def render_header def render_header
site = Site.first site = current_site
header_file = File.join('../templates', "#{@key}", "/home/header.html.erb") header_file = File.join('../templates', "#{@key}", "/home/header.html.erb")
header_file_html = render :file => header_file header_file_html = render :file => header_file
header = Nokogiri::HTML(header_file_html, nil, "UTF-8") header = Nokogiri::HTML(header_file_html, nil, "UTF-8")
site_logo = header.css("img[src='{{logo_url}}']")[0]
site_logo.remove if site.site_logo.url.nil?
sub_menu_html = site.sub_menu sub_menu_html = site.sub_menu
html = header.to_s html = header.to_s
html = html.gsub("{{site_name}}",site.title) t = site.title rescue ""
html = html.gsub("%7B%7Blogo_url%7D%7D",(site.site_logo.url.nil? ? "/assets/site-logo.png" : site.site_logo.url)) html = html.gsub("{{site_name}}",(site.display_title_in_frontend ? t : ""))
html = html.gsub("%7B%7Blogo_url%7D%7D",(site.site_logo.url.nil? ? "/assets/default-site-logo.png" : site.site_logo.url))
if site.sitemap_menu_in_header if site.sitemap_menu_in_header
sub_menu_html = sub_menu_html + "<a href='/#{I18n.locale.to_s}#{site.site_map_link}'>Sitemap</a>" sitemap = Page.find_by_key(:sitemap).name rescue "Sitemap"
sub_menu_html = sub_menu_html + "<a href='/#{I18n.locale.to_s}#{site.site_map_link}'>#{sitemap}</a>"
end end
sub_menu_html = sub_menu_html.nil? ? "" : sub_menu_html sub_menu_html = sub_menu_html.nil? ? "" : sub_menu_html
html = html.gsub("{{header-data}}",sub_menu_html) html = html.gsub("{{header-data}}",sub_menu_html)
@ -33,24 +37,27 @@ module ApplicationHelper
end end
def render_site_title def render_site_title
site = Site.first site = current_site
title = site.title rescue "" title = site.title rescue ""
if site.title_always_on if site.title_always_on
if !params[:slug].nil? if !params[:slug].nil?
temp_title = params[:slug].sub("-#{params[:uid]}","") temp_title = params[:slug].sub("-#{params[:uid]}","")
temp_title = temp_title.gsub("-"," ") temp_title = temp_title.gsub("-"," ")
title = "#{temp_title} | #{title}" title = "#{temp_title} | #{title}"
elsif params[:target_action] == "index"
temp_title = Page.find_by(:page_id => params[:page_id]).name
title = "#{temp_title} | #{title}"
end end
end end
title title
end end
def render_google_analytics def render_google_analytics
Site.first.google_analytics.html_safe rescue "" current_site.google_analytics.html_safe rescue ""
end end
def render_footer def render_footer
site = Site.first site = current_site
footer_file = File.join('../templates', "#{@key}", "/home/footer.html.erb") footer_file = File.join('../templates', "#{@key}", "/home/footer.html.erb")
footer_file_html = render :file => footer_file footer_file_html = render :file => footer_file
footer = Nokogiri::HTML(footer_file_html, nil, "UTF-8") footer = Nokogiri::HTML(footer_file_html, nil, "UTF-8")
@ -61,6 +68,9 @@ module ApplicationHelper
end end
site_footer = site_footer.nil? ? "" : site_footer site_footer = site_footer.nil? ? "" : site_footer
html = html.gsub("{{footer-data}}",site_footer) html = html.gsub("{{footer-data}}",site_footer)
counter = Page.root.view_count.to_s rescue ""
counter = t(:visitors_count) + " : " + counter
html = html.gsub("{{site-counter}}",counter)
html.html_safe html.html_safe
end end
@ -71,24 +81,38 @@ module ApplicationHelper
end end
def render_menu def render_menu
# menu_html = Rails.cache.fetch(['main_menu',request.original_fullpath, I18n.locale], race_condition_ttl: 2.seconds) do
# json_file = File.read(File.join(Rails.root, 'public', "menu.json")) # json_file = File.read(File.join(Rails.root, 'public', "menu.json"))
# @items = JSON.parse(json_file) # @items = JSON.parse(json_file)
if $mobile.blank?
@pages = Page.root.sorted_published_child_pages @pages = Page.root.sorted_published_child_pages
else
@pages = Page.root.sorted_published_child_pages_for_mobile
end
def create_json(pages) def create_json(pages)
item = {} item = {}
pages.each do |page| pages.each do |page|
if page.child_page.size > 0 if page.child_page.size > 0
if page.page_type == "page" if page.page_type == "page"
if $mobile.blank?
item["#{page.name}"] = {"url"=> "/#{locale.to_s}" + page.url, "children"=>create_json(page.sorted_published_child_pages), "target" => "_self"} item["#{page.name}"] = {"url"=> "/#{locale.to_s}" + page.url, "children"=>create_json(page.sorted_published_child_pages), "target" => "_self"}
else
item["#{page.name}"] = {"url"=> "/#{locale.to_s}" + page.url, "children"=>create_json(page.sorted_published_child_pages_for_mobile), "target" => "_self"}
end
elsif page.page_type == "link" elsif page.page_type == "link"
item["#{page.name}"] = {"url"=> page.external_url, "children"=>create_json(page.sorted_published_child_pages), "target" => "_blank"} target = get_target(page.external_url)
if $mobile.blank?
item["#{page.name}"] = {"url"=> page.external_url, "children"=>create_json(page.sorted_published_child_pages), "target" => target}
else
item["#{page.name}"] = {"url"=> page.external_url, "children"=>create_json(page.sorted_published_child_pages_for_mobile), "target" => target}
end
end end
else else
if page.page_type == "page" if page.page_type == "page"
item["#{page.name}"] = {"url"=> "/#{locale.to_s}" + page.url, "target" => "_self"} item["#{page.name}"] = {"url"=> "/#{locale.to_s}" + page.url, "target" => "_self"}
elsif page.page_type == "link" elsif page.page_type == "link"
item["#{page.name}"] = {"url"=> page.external_url, "target" => "_blank"} item["#{page.name}"] = {"url"=> page.external_url, "target" => get_target(page.external_url)}
end end
end end
end end
@ -128,9 +152,9 @@ module ApplicationHelper
def create_menu(items,level) def create_menu(items,level)
html = "" html = ""
items.each do |key,item| items.each do |key,item|
li = @menus_items[level].gsub("href_here",item["url"]) li = @menus_items[level].gsub("href_here",(item["url"] || ""))
li = li.gsub("{{link_name}}",key) li = li.gsub("{{link_name}}",(key || ""))
li = li.gsub("target_here",item["target"]) li = li.gsub("target_here",(item["target"] || ""))
li = request.original_fullpath == item['url'] ? li.gsub("{{active}}","active") : li.gsub("{{active}}","") li = request.original_fullpath == item['url'] ? li.gsub("{{active}}","active") : li.gsub("{{active}}","")
if item["children"] && !item["children"].empty? if item["children"] && !item["children"].empty?
@ -146,10 +170,22 @@ module ApplicationHelper
end end
h = create_menu(@items,0) h = create_menu(@items,0)
h.html_safe h.html_safe
# end
# menu_html
end end
def render_view def render_view
def render_link_to_edit(html, url_to_edit)
if html.scan("{{link_to_edit}}").length == 0
html = url_to_edit.blank? ? html : html + "<p class='admin-edit text-right'><a class='btn btn-primary' href='#{url_to_edit}'><i class='icon-edit'></i> #{t(:edit)}</a></p>"
else
html = url_to_edit.blank? ? html.gsub("{{link_to_edit}}","") : html.gsub("{{link_to_edit}}","<p class='admin-edit text-right'><a class='btn btn-primary' href='#{url_to_edit}'><i class='icon-edit'></i> #{t(:edit)}</a></p>")
end
return html
end
def parsing_repeats_again(elements,d,level) def parsing_repeats_again(elements,d,level)
newhtml = [] newhtml = []
oldhtml = [] oldhtml = []
@ -157,11 +193,11 @@ module ApplicationHelper
html_to_render = "" html_to_render = ""
data_name = el.attr("data-list") data_name = el.attr("data-list")
wrap_elements = el.css("*[data-list][data-level='#{level}']") wrap_elements = el.css("*[data-list][data-level='#{level}']")
if d["#{data_name}"] if d[data_name]
d["#{data_name}"].each_with_index do |item,i| d[data_name].each_with_index do |item,i|
element = el.inner_html element = el.inner_html
if wrap_elements.count > 0 if wrap_elements.count > 0
htmls = parsing_repeats_again(wrap_elements,d["#{data_name}"][i], level + 1) htmls = parsing_repeats_again(wrap_elements,d[data_name][i], level + 1)
htmls[0].each_with_index do |html,i| htmls[0].each_with_index do |html,i|
element = element.gsub(html,htmls[1][i]) element = element.gsub(html,htmls[1][i])
end end
@ -169,8 +205,9 @@ module ApplicationHelper
item.each do |key,value| item.each do |key,value|
if !value.kind_of?(Array) if !value.kind_of?(Array)
value = value.nil? ? "" : value value = value.nil? ? "" : value
element = element.gsub("{{#{key}}}",value.to_s) element = element.gsub("{{#{key}}}",value.to_s.html_safe)
element = element.gsub("%7B%7B#{key}%7D%7D",value.to_s) element = element.gsub("%7B%7B#{key}%7D%7D",value.to_s.html_safe)
element = render_link_to_edit(element, value) if key.eql?("url_to_edit")
end end
end end
html_to_render = html_to_render + element html_to_render = html_to_render + element
@ -189,25 +226,32 @@ module ApplicationHelper
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "#{params[:layout_type]}.html.erb") f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "#{params[:layout_type]}.html.erb")
if !File.exists?f if !File.exists?f
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "index.html.erb") f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "index.html.erb")
if !File.exists?f
return "<div class='well'>Maybe the administrator has changed the theme, please select the index page design again from the page settings.</div>".html_safe
end
end end
file = File.open(f) file = File.open(f)
doc = Nokogiri::HTML(file, nil, "UTF-8") doc = Nokogiri::HTML(file, nil, "UTF-8")
file.close file.close
controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new
data = controller.send("#{params[:target_action]}") begin
data = controller.send("#{params[:target_action]}")# rescue nil
rescue Exception => e
write_debug_file(e,params[:target_controller],params[:target_action]) if Site::DEBUG
end
if !data.nil?
wrap_elements = doc.css("*[data-list][data-level='0']") wrap_elements = doc.css("*[data-list][data-level='0']")
htmls = parsing_repeats_again(wrap_elements,data,1) htmls = parsing_repeats_again(wrap_elements,data,1)
html = doc.to_s html = doc.to_s
htmls[0].each_with_index do |h,i| htmls[0].each_with_index do |h,i|
html = html.gsub(h,htmls[1][i]) html = html.gsub(h,htmls[1][i])
end end
extras = data["extras"] || {}
if data["extras"] extras["page-title"] = Page.find_by(:page_id => params[:page_id]).name rescue "" if !extras["page-title"]
data["extras"].each do |key,value| extras.each do |key,value|
value = value.nil? ? "" : value value = value.nil? ? "" : value
html = html.gsub("{{#{key}}}",value.to_s) html = html.gsub("{{#{key}}}",value.to_s.html_safe)
html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s) html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s.html_safe)
end
end end
total_pages = data['total_pages'].to_i rescue 1 total_pages = data['total_pages'].to_i rescue 1
if total_pages > 1 if total_pages > 1
@ -216,6 +260,9 @@ module ApplicationHelper
html = html.gsub("{{pagination_goes_here}}",""); html = html.gsub("{{pagination_goes_here}}","");
end end
html.html_safe html.html_safe
else
return "<div class='well'>No content to show.</div>".html_safe
end
else else
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "#{params[:target_action]}.html.erb") f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', params[:target_controller].singularize, "#{params[:target_action]}.html.erb")
if File.exists?f if File.exists?f
@ -223,7 +270,14 @@ module ApplicationHelper
doc = Nokogiri::HTML(file, nil, "UTF-8") doc = Nokogiri::HTML(file, nil, "UTF-8")
file.close file.close
controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new controller = "#{params[:target_controller].capitalize}_controller".classify.constantize.new
data = controller.send("#{params[:target_action]}") begin
data = controller.send("#{params[:target_action]}")# rescue nil
rescue Exception => e
write_debug_file(e,params[:target_controller],params[:target_action]) if Site::DEBUG
end
if data.nil?
return "<div class='well'> No content to show. </div>".html_safe
end
if data.blank? || data.empty? if data.blank? || data.empty?
file = File.open("#{Rails.root}/public/404.html") file = File.open("#{Rails.root}/public/404.html")
@ -232,6 +286,7 @@ module ApplicationHelper
doc.to_html.html_safe doc.to_html.html_safe
else else
unless data['impressionist'].blank? unless data['impressionist'].blank?
Thread.new do
impression = data['impressionist'].impressions.create impression = data['impressionist'].impressions.create
impression.user_id = request.session['user_id'] impression.user_id = request.session['user_id']
impression.controller_name = params[:target_controller] impression.controller_name = params[:target_controller]
@ -241,8 +296,8 @@ module ApplicationHelper
impression.request_hash = @impressionist_hash impression.request_hash = @impressionist_hash
impression.referrer = request.referrer impression.referrer = request.referrer
impression.save impression.save
data['impressionist'].view_count = data['impressionist'].impressions.count data['impressionist'].inc(view_count: 1)
data['impressionist'].save end
end end
wrap_elements = doc.css("*[data-list][data-level='0']") wrap_elements = doc.css("*[data-list][data-level='0']")
if wrap_elements.count == 0 if wrap_elements.count == 0
@ -251,8 +306,8 @@ module ApplicationHelper
data.each do |key,value| data.each do |key,value|
next if key.eql? 'impressionist' next if key.eql? 'impressionist'
value = value.nil? ? "" : value value = value.nil? ? "" : value
el = el.gsub("{{#{key}}}",value.to_s) el = el.gsub("{{#{key}}}",value.to_s.html_safe)
el = el.gsub("%7B%7B#{key}%7D%7D",value.to_s) el = el.gsub("%7B%7B#{key}%7D%7D",value.to_s.html_safe)
end end
el.html_safe el.html_safe
else else
@ -266,17 +321,19 @@ module ApplicationHelper
htmls[0].each_with_index do |h,i| htmls[0].each_with_index do |h,i|
html = html.gsub(h,htmls[1][i]) html = html.gsub(h,htmls[1][i])
end end
if data["#{not_array_key}"] extras = data["#{not_array_key}"] || {}
data["#{not_array_key}"].each do |key,value| extras.each do |key,value|
next if key.eql? 'impressionist' next if key.eql? 'impressionist'
value = value.nil? ? "" : value value = value.nil? ? "" : value
html = html.gsub("{{#{key}}}",value.to_s) html = html.gsub("{{#{key}}}",value.to_s)
html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s) html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s)
end end
end html = render_link_to_edit(html, data["url_to_edit"]) if !data["url_to_edit"].nil?
html.html_safe html.html_safe
end end
end end
else
return "<div class='well'>There is a problem with the design. We will try to fix it as soon as possible. Sorry for the inconvenience!! :(</div>".html_safe
end end
end end
end end
@ -299,12 +356,12 @@ module ApplicationHelper
((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil ((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil
end end
def link_back(custom_class=nil) def link_back(custom_class=nil, params="")
case custom_class case custom_class
when nil when nil
link_to t('back'), get_go_back, :class => 'nav' link_to t('back'), get_go_back + params, :class => 'nav'
else else
link_to t('back'), get_go_back, :class => custom_class link_to t('back'), get_go_back + params, :class => custom_class
end end
end end
@ -315,7 +372,7 @@ module ApplicationHelper
url = url.gsub("/#{locale.to_s}/","/#{loc.to_s}/") url = url.gsub("/#{locale.to_s}/","/#{loc.to_s}/")
url = url.gsub("locale=#{locale.to_s}","locale=#{loc.to_s}") if url == request.original_fullpath url = url.gsub("locale=#{locale.to_s}","locale=#{loc.to_s}") if url == request.original_fullpath
url = url + "#{url.include?("?") ? "&" : "?"}locale=#{loc.to_s}" if url == request.original_fullpath and !url.include?(locale.to_s) url = url + "#{url.include?("?") ? "&" : "?"}locale=#{loc.to_s}" if url == request.original_fullpath and (!url.include?('/'+locale.to_s) or !url.include?(locale.to_s+'='))
url url
end end
@ -338,14 +395,23 @@ module ApplicationHelper
def render_sitemap def render_sitemap
items = action_data items = action_data
def node(items) def node(items, level)
html = "<ul>" class_name = nil
case level
when 0
class_name = "sitemap-list level-1"
when 1
class_name = "sitemap-list level-2"
when 2
class_name = "sitemap-list level-3"
end
html = "<ul class='#{class_name}'>"
items.each do |key,item| items.each do |key,item|
if item["children"] && !item["children"].empty? if item["children"] && !item["children"].empty?
url = item["url"] url = item["url"]
target = item["target"] target = item["target"]
html = html + "<li><a href='#{url}' target='#{target}'>#{key}</a>" html = html + "<li><a href='#{url}' target='#{target}'>#{key}</a>"
html = html + node(item["children"]) html = html + node(item["children"],level + 1)
html = html + "</li>" html = html + "</li>"
else else
target = item["target"] target = item["target"]
@ -356,7 +422,7 @@ module ApplicationHelper
html = html + "</ul>" html = html + "</ul>"
html html
end end
html = node(items) html = node(items,0)
html.html_safe html.html_safe
end end
@ -377,12 +443,14 @@ module ApplicationHelper
file = File.open(file) file = File.open(file)
doc = Nokogiri::HTML(file, nil, "UTF-8") doc = Nokogiri::HTML(file, nil, "UTF-8")
file.close file.close
querystring = request.GET rescue {}
querystring.delete("page_no")
paginationobj = doc.css("*[data-pagination='true']").first paginationobj = doc.css("*[data-pagination='true']").first
in_html = first = last = nextpage = prevpage = paginationobj.inner_html in_html = first = last = nextpage = prevpage = paginationobj.inner_html
f_html = "" f_html = ""
current_page_number = OrbitHelper.page_number current_page_number = OrbitHelper.page_number
if current_page_number > 1 if current_page_number > 1
first = first.gsub("%7B%7Bpagination_link%7D%7D","?page_no=1") first = first.gsub("%7B%7Bpagination_link%7D%7D","?page_no=1&#{querystring.to_query}")
first = first.gsub("{{page_number}}","First") first = first.gsub("{{page_number}}","First")
first = first.gsub("{{pagination_active}}","") first = first.gsub("{{pagination_active}}","")
f_html = f_html + first f_html = f_html + first
@ -400,25 +468,25 @@ module ApplicationHelper
end_number = end_number > total_pages ? total_pages : end_number end_number = end_number > total_pages ? total_pages : end_number
(start_number..end_number).each do |i| (start_number..end_number).each do |i|
h = in_html h = in_html
h = h.gsub("%7B%7Bpagination_link%7D%7D","?page_no=#{i.to_s}") h = h.gsub("%7B%7Bpagination_link%7D%7D","?page_no=#{i.to_s}&#{querystring.to_query}")
h = h.gsub("{{page_number}}",i.to_s) h = h.gsub("{{page_number}}",i.to_s)
h = h.gsub("{{pagination_active}}",(i == current_page_number ? "active" : "")) h = h.gsub("{{pagination_active}}",(i == current_page_number ? "active" : ""))
f_html = f_html + h f_html = f_html + h
end end
if current_page_number > 1 if current_page_number > 1
prevpage = prevpage.gsub("%7B%7Bpagination_link%7D%7D","?page_no=#{current_page_number - 1}") prevpage = prevpage.gsub("%7B%7Bpagination_link%7D%7D","?page_no=#{current_page_number - 1}&#{querystring.to_query}")
prevpage = prevpage.gsub("{{page_number}}","&laquo;") prevpage = prevpage.gsub("{{page_number}}","&laquo;")
prevpage = prevpage.gsub("{{pagination_active}}","") prevpage = prevpage.gsub("{{pagination_active}}","")
f_html = f_html + prevpage f_html = f_html + prevpage
end end
if current_page_number < total_pages if current_page_number < total_pages
nextpage = nextpage.gsub("%7B%7Bpagination_link%7D%7D","?page_no=#{current_page_number + 1}") nextpage = nextpage.gsub("%7B%7Bpagination_link%7D%7D","?page_no=#{current_page_number + 1}&#{querystring.to_query}")
nextpage = nextpage.gsub("{{page_number}}","&raquo;") nextpage = nextpage.gsub("{{page_number}}","&raquo;")
nextpage = nextpage.gsub("{{pagination_active}}","") nextpage = nextpage.gsub("{{pagination_active}}","")
f_html = f_html + nextpage f_html = f_html + nextpage
last = last.gsub("%7B%7Bpagination_link%7D%7D","?page_no=#{total_pages}") last = last.gsub("%7B%7Bpagination_link%7D%7D","?page_no=#{total_pages}&#{querystring.to_query}")
last = last.gsub("{{page_number}}","Last") last = last.gsub("{{page_number}}","Last")
last = last.gsub("{{pagination_active}}","") last = last.gsub("{{pagination_active}}","")
f_html = f_html + last f_html = f_html + last
@ -429,4 +497,60 @@ module ApplicationHelper
html html
end end
def get_target(link)
target = "_blank"
if !link.nil?
link = link.split("?").first
temp_url = URI.parse(link)
if temp_url.host.nil?
target = "_self"
end
end
target
end
def write_debug_file(e,controller_name,action_name)
url_dir_name = request.fullpath.split("?")[0]
url_dir_name = URI.decode(url_dir_name)
url_dir_name = (url_dir_name == "/" ? "home" : url_dir_name.sub("/","").gsub("/","_").gsub("-","_").gsub(" ","_"))
directory_name = "tmp/debug/#{url_dir_name}"
FileUtils.mkdir_p(directory_name) unless File.exists?(directory_name)
fn = "#{directory_name}/#{controller_name}_#{action_name}.html"
error_trace_spans = ""
e.backtrace.each do |bt|
error_trace_spans = error_trace_spans + "<span>#{bt}</span><br />"
end
con = "#{controller_name.capitalize}_controller".classify.constantize
File.open(fn, "w"){ |file|
file.puts "<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
<meta charset=UTF-8'>
<title>Debug result</title>
</head>
<body>
<h3>Error Message</h3>
<div class='error-message'>
<h2><i>#{e.message}</i></h2>
</div>
<h3>Request Details</h3>
<div class='request-details'>
<span>Url : <b>#{URI.decode(request.url)}</b></span><br />
<span>Controller : <b>#{con.to_s}</b> </span><br />
<span>Action : <b>#{action_name.capitalize}</b> </span>
</div>
<h3>Error Trace</h3>
<div class='error-trace'>
#{error_trace_spans}
</div>
<h3>Params</h3>
<div class='params'>
#{OrbitHelper.params}
</div>
</body>
</html>"
}
end
end end

View File

@ -101,14 +101,17 @@ module AttributeFieldsHelper
# @prefiled_value = @attribute_value.get_date # @prefiled_value = @attribute_value.get_date
case self.typeC['format'] case self.typeC['format']
when 'format1' # when 'format1'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d %H:%M")), 'yyyy/MM/dd hh:mm', true) # tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d %H:%M")), 'yyyy/MM/dd hh:mm', true)
when 'format2' when 'format1','format2'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d")), 'yyyy/MM/dd') # tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d")), 'yyyy/MM/dd')
tmp = very_simple_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d")), self.typeC['format'])
when 'format3' when 'format3'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), 'yyyy/MM') # tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), 'yyyy/MM')
tmp = very_simple_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), self.typeC['format'])
when 'format4' when 'format4'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy') # tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy')
tmp = very_simple_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), self.typeC['format'])
end end
control_group_wrapper{tmp} control_group_wrapper{tmp}
@ -117,6 +120,28 @@ module AttributeFieldsHelper
end end
end end
def very_simple_picker(object_name, value, format)
id = object_name.gsub("[","_").gsub("]","")
values = value.split("/") rescue []
html = "<div class='simple-date-picker'>"
if format == "format1" || format == "format2"
html = html + "<input type='text' class='span1' #{(!values.blank? ? "value='#{values[2]}'" : "")} placeholder='Date' onkeypress='return (event.charCode >= 48 && event.charCode <= 57) || event.keyCode == 8 || event.keyCode == 46 || (event.keyCode >= 37 && event.keyCode <= 40) || event.keyCode == 9' onkeyup='this.value=(this.value.length <= 2 ? (parseInt(this.value) > 0 && parseInt(this.value) < 32 ? this.value : this.value.substring(0,this.value.length-1)) : this.value.substring(0,this.value.length-1))' onblur='var el = document.getElementById(\"#{id}\");var k = el.value.split(\"/\");if(this.value){k[2]=this.value; el.value = k.join(\"/\")};'>"
end
if format == "format1" || format == "format2" || format == "format3"
html = html + "<select class='span2' onchange='var el = document.getElementById(\"#{id}\");var k = el.value.split(\"/\");if(this.value){k[1]=this.value; el.value = k.join(\"/\")};'>"
["January","February","March","April","May","June","July","August","September","October","November","December"].each_with_index do |mon,index|
mon_value = "#{(index < 9 ? "0" : "")}#{(index + 1).to_s}"
html = html + "<option value='#{(index < 9 ? "0" : "")}#{(index + 1).to_s}' #{values[1] == mon_value ? 'selected="selected"' : ""}>#{mon}</option>"
end
html = html + "</select>"
end
html = html + "<input type='text' class='span1' #{(!values.blank? ? "value='#{values[0]}'" : "")} placeholder='Year' onkeypress='return (event.charCode >= 48 && event.charCode <= 57) || event.keyCode == 8 || event.keyCode == 46 || (event.keyCode >= 37 && event.keyCode <= 40) event.keyCode == 9' onkeyup='this.value=(this.value.length == 4 ? (parseInt(this.value) > 1900 && parseInt(this.value) < 3000 ? this.value : this.value.substring(0,this.value.length-1)) : (this.value.length > 4 ? this.value.substring(0,this.value.length-1) : this.value))' onblur='var el = document.getElementById(\"#{id}\");var k = el.value.split(\"/\");if(this.value){k[0]=this.value; el.value = k.join(\"/\")};'>"
html = html + hidden_field_tag(object_name, (value || "1901/01/01"))
html = html + "</div>"
html.html_safe
end
def datetime_picker(object_name, value, format, time=false) def datetime_picker(object_name, value, format, time=false)
content_tag :div, :class => "input-append datetimepick", "data-date-format"=>format, "data-picktime"=>"#{time}" do content_tag :div, :class => "input-append datetimepick", "data-date-format"=>format, "data-picktime"=>"#{time}" do
concat text_field_tag(object_name, value, :placeholder=>format) concat text_field_tag(object_name, value, :placeholder=>format)
@ -150,7 +175,7 @@ module AttributeFieldsHelper
def render_text_area def render_text_area
control_group_wrapper do |key,value| control_group_wrapper do |key,value|
value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value rescue nil
key = can_muti_lang_input? ? "[#{key}]" : "" key = can_muti_lang_input? ? "[#{key}]" : ""
place_holder= @panel_setting["placeholder"][I18n.locale.to_s] rescue '' place_holder= @panel_setting["placeholder"][I18n.locale.to_s] rescue ''
text_area_tag(get_field_name_base + key, value,@markup_options.merge(:placeholder=>place_holder)) text_area_tag(get_field_name_base + key, value,@markup_options.merge(:placeholder=>place_holder))
@ -179,7 +204,7 @@ protected
def valid_locales def valid_locales
site = Site.first site = Site.first
site.valid_locales [I18n.locale]+(site.valid_locales-[I18n.locale])
end end
def lang_panel_tabbable_wrapper(add_more_params,&block) def lang_panel_tabbable_wrapper(add_more_params,&block)
@ -202,7 +227,7 @@ protected
end end
div_class = div_class_ary.join(" ") div_class = div_class_ary.join(" ")
div_class << (key == I18n.locale.to_s ? " active in" : '') div_class << (key == I18n.locale ? " active in" : '')
content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class) content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class)
end# of VALID_LOCALES.collect for tabed input end# of VALID_LOCALES.collect for tabed input
@ -213,7 +238,7 @@ protected
link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"] link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"]
link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more
link_entry = link_entry_ary.join link_entry = link_entry_ary.join
link_to(I18n.t(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale.to_s ? "active" : nil)}",:for=>key) link_to(I18n.t(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale ? "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'),"##{get_pairing_tab_class({})}_m_window", :role=>"button",:class=>'btn',:data=>{:toggle=>"modal"}) if self.markup == 'address'
@ -248,7 +273,7 @@ protected
end end
div_class = div_class_ary.join(" ") div_class = div_class_ary.join(" ")
div_class << (key == I18n.locale.to_s ? " active in" : '') div_class << (key == I18n.locale ? " active in" : '')
content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class) content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class)
end# of VALID_LOCALES.collect for tabed input end# of VALID_LOCALES.collect for tabed input
@ -262,7 +287,7 @@ protected
link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"] link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"]
link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more
link_entry = link_entry_ary.join link_entry = link_entry_ary.join
link_to(I18n.t(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale.to_s ? "active" : nil)}",:for=>key) link_to(I18n.t(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale ? "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'),"#address-field", :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'

View File

@ -22,7 +22,7 @@ module AttributeValuesHelper
end end
def show_minguo_calendar(from_to=nil) def show_minguo_calendar(from_to=nil)
get_minguo # get_minguo
case from_to case from_to
when :to when :to
@ -96,12 +96,14 @@ module AttributeValuesHelper
def get_date_by_format(from_to = nil) def get_date_by_format(from_to = nil)
case I18n.locale case I18n.locale
when :zh_tw when :zh_tw
case # case
when self.member_profile_field["typeC"]["calendar"] == "west_calendar" # when self.member_profile_field["typeC"]["calendar"] == "west_calendar"
# show_west_calender(from_to)
# when self.member_profile_field["typeC"]["calendar"] == "tw_calendar"
# show_minguo_calendar(from_to)
# end #case self.member_profile_field["typeC"]["calendar"]
show_west_calender(from_to) show_west_calender(from_to)
when self.member_profile_field["typeC"]["calendar"] == "tw_calendar"
show_minguo_calendar(from_to)
end #case self.member_profile_field["typeC"]["calendar"]
when :en when :en
show_west_calender(from_to) show_west_calender(from_to)
end end

View File

@ -1,3 +1,5 @@
require "uri"
require "net/http"
module OrbitBackendHelper module OrbitBackendHelper
def self.included(base) def self.included(base)
@ -5,11 +7,15 @@ module OrbitBackendHelper
end end
def thead(field) def thead(field)
active = params[:sort].eql? field.to_s sort = field.to_s.include?('.') ? field.to_s.split('.')[1] : field.to_s
active = params[:sort].eql? sort
order = active ? (["asc", "desc"]-[params[:order]]).first : "asc" order = active ? (["asc", "desc"]-[params[:order]]).first : "asc"
arrow = (order.eql? "desc") ? "<b class='icons-arrow-up-3'></b>" : "<b class='icons-arrow-down-4'></b>" arrow = (order.eql? "desc") ? "<b class='icons-arrow-up-3'></b>" : "<b class='icons-arrow-down-4'></b>"
klass = field.eql?(:title) ? "span5" : "span2" klass = field.eql?(:title) ? "span5" : "span2"
"<th class='#{klass} #{active ? "active" : ""}'><a href='?sort=#{field}&order=#{order}''>#{t(field.to_sym)} #{active ? arrow : ""}</a></th>".html_safe
th_data = (sort=="preview") ? t(field.to_sym) : "<a href='?sort=#{sort}&order=#{order}'>#{t(field.to_sym)} #{active ? arrow : ""}</a>"
"<th class='#{klass} #{active ? "active" : ""}'>#{th_data}</th>".html_safe
end end
def datetime_picker(object_name, method, options = {}) def datetime_picker(object_name, method, options = {})
@ -17,6 +23,7 @@ module OrbitBackendHelper
options[:icon_date] ||= 'icons-calendar' options[:icon_date] ||= 'icons-calendar'
options[:icon_clear] ||= 'icons-cross-3' options[:icon_clear] ||= 'icons-cross-3'
options[:input_class] ||= 'input-large' options[:input_class] ||= 'input-large'
options[:new_record] = true if options[:new_record].nil?
options[:value] ||= options[:object].send(method) if options[:object] && options[:object][method] options[:value] ||= options[:object].send(method) if options[:object] && options[:object][method]
case options[:picker_type] case options[:picker_type]
when 'date' when 'date'
@ -34,6 +41,10 @@ module OrbitBackendHelper
concat hidden_field(object_name, method, :value => options[:value]) concat hidden_field(object_name, method, :value => options[:value])
concat separated_picker(object_name, method, options) concat separated_picker(object_name, method, options)
end end
when 'simple'
content_tag :div, :id => options[:id], :class => options[:class] do
simple_picker(object_name, method, options)
end
else else
content_tag :div, :id => options[:id], :class => options[:class] do content_tag :div, :id => options[:id], :class => options[:class] do
default_picker(object_name, method, options) default_picker(object_name, method, options)
@ -44,7 +55,8 @@ module OrbitBackendHelper
def default_picker(object_name, method, options) def default_picker(object_name, method, options)
custom = {} custom = {}
custom[:format] = options[:format] || 'yyyy/MM/dd hh:mm' custom[:format] = options[:format] || 'yyyy/MM/dd hh:mm'
custom[:value] = format_value(options[:value], custom[:format]) if options[:value] custom[:value] = format_value(options[:value], custom[:format]) if options[:value] && !options[:new_record]
custom[:value] = "" if options[:new_record]
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')
@ -81,48 +93,146 @@ module OrbitBackendHelper
def select_category(f, module_app) def select_category(f, module_app)
render :partial => '/admin/categories/select_form', :locals => {:f=> f, :module_app=>module_app, :categories=>module_app.categories.enabled } @user_authorized_categories = module_app.categories.enabled.authorized(current_user) if @user_authorized_categories.nil?
render :partial => '/admin/categories/select_form', :locals => {:f=> f, :module_app=>module_app, :categories=> @user_authorized_categories }
end end
def select_tags(f, module_app) def select_tags(f, module_app)
render :partial => '/admin/tags/tag_form', :locals => {:f=> f, :module_app=>module_app, :tags=>module_app.tags } render :partial => '/admin/tags/tag_form', :locals => {:f=> f, :module_app=>module_app, :tags=>module_app.tags }
end end
def render_filter(fields) def render_filter(fields, search_dom_id=nil, quick_new=false)
render :partial => "shared/filter", :locals =>{:fields => fields} render :partial => "shared/filter", :locals =>{:fields => fields, :search_dom_id=>search_dom_id, :quick_new=>quick_new}
end end
def display_visitors(options={}) def display_visitors(options={})
Impression.where(options).distinct(:request_hash).count Impression.where(options).count
end end
def display_visitors_today def display_visitors_today
display_visitors(created_at: {'$gte' => Time.now.beginning_of_day, '$lte' => Time.now}) display_visitors(created_at: {'$gte' => Time.now.beginning_of_day})
end end
def display_visitors_this_week def display_visitors_this_week
display_visitors(created_at: {'$gte' => Time.now-7.days, '$lte' => Time.now}) display_visitors(created_at: {'$gte' => Time.now.beginning_of_week})
end end
def display_visitors_this_month def display_visitors_this_month
display_visitors(created_at: {'$gte' => Time.now-30.days, '$lte' => Time.now}) visitors_this_month = Rails.cache.fetch("visitors_this_month", expires_in: 1.day) do
display_visitors(created_at: {'$gte' => Time.now.beginning_of_month})
end
visitors_this_month
end end
def display_visitors_this_year def display_visitors_this_year
display_visitors(created_at: {'$gte' => Time.now-365.days, '$lte' => Time.now}) visitors_this_year = Rails.cache.fetch("visitors_this_year", expires_in: 1.day) do
display_visitors(created_at: {'$gte' => Time.now.beginning_of_year})
end
visitors_this_year
end end
def get_month_traffic def get_month_traffic
result = [] site = Site.first
(0..30).each do |i| if site.month_traffic_cache.blank? or (site.month_traffic_cache['updated_at'] < (Time.now-1.day) rescue true)
site.month_traffic_cache = {}
site.month_traffic_cache['result'] = []
(1..30).each do |i|
visits = Impression.where( created_at: { visits = Impression.where( created_at: {
'$gte' => Time.now.beginning_of_day-i.days, '$gte' => Time.now.beginning_of_day-i.days,
'$lte' => Time.now.end_of_day-i.days} '$lte' => Time.now.end_of_day-i.days}
).distinct(:request_hash).count ).distinct(:request_hash).count
result.push([ Time.now.beginning_of_day-i.days, visits]) site.month_traffic_cache['result'].push([ Time.now.beginning_of_day-i.days, visits])
end end
[:name=> t(:visitors_count),:data=>result] site.month_traffic_cache['updated_at'] = Time.now
site.save
end
[:name=> t(:visitors_count),:data=>site.month_traffic_cache['result']]
end
def can_edit_or_delete?(obj)
create_user = obj.create_user_id.to_s rescue nil
if @user_authenticated_categories.first == "all"
return true
elsif @current_user_is_sub_manager && !create_user.nil?
create_user == current_user.id.to_s
else
@user_authenticated_categories.include?obj.category_id rescue (current_user.is_manager?(@module_app) rescue false)
end
end
def user_authenticated_categories
@user_authenticated_categories
end
def is_user_sub_manager?
@current_user_is_sub_manager
end
def has_access? #@user_has_privileges comes from orbit_member_controller.. used just in members
@user_has_privileges
end
def check_store_permissions #checks with the store if it has proper access and rights to access store
store_permission = {}
store_token = current_site.store_token rescue nil
if !store_token.nil?
params_to_send = {'store_token' => current_site.store_token}
uri = URI.parse(OrbitStore::URL)
http = Net::HTTP.new(uri.host,uri.port)
request = Net::HTTP::Get.new("/site/permissions")
request.body = params_to_send.to_query
response = http.request(request) rescue nil
if response.nil?
data = {}
data["message"] = "Could not connect to the store."
data["error"] = "CONNECTION_REFUSED"
data["success"] = false
else
data = JSON.parse(response.body)
end
if !data["success"]
case data["error"]
when "INVALID_SITE_TOKEN"
current_site.store_token = nil
current_site.save
end
store_permission["permission_granted"] = false
store_permission["error"] = data["error"]
store_permission["message"] = data["message"]
else
store_permission["permission_granted"] = true
end
else
store_permission["permission_granted"] = false
store_permission["error"] = "SITE_NOT_REGISTERED"
store_permission["message"] = "Site not registered."
end
store_permission
end
def render_401
render "public/401"
end
def render_403
render "public/403"
end
def need_access_right
render_401 if !has_access?
end
def get_referer_url
referer_path = Rails.application.routes.recognize_path(request.referer)
if referer_path[:controller]!="pages" or (referer_path[:controller]==params[:controller] and referer_path[:action]!="index")
referer_url = '/'+params[:controller]
else
referer_url = request.referer
end
referer_url
end end
end end

View File

@ -32,6 +32,19 @@ module OrbitFormHelper
end end
end end
def simple_picker(object_name, method, options)
html = "<div class='simple-date-picker'>
<input type='text' class='span1' #{(options[:value] ? "value='#{options[:value].day}'" : "")} placeholder='Date' onkeypress='return (event.charCode >= 48 && event.charCode <= 57) || event.keyCode == 8 || event.keyCode == 46 || (event.keyCode >= 37 && event.keyCode <= 40) || event.keyCode == 9' onkeyup='this.value=(this.value.length <= 2 ? (parseInt(this.value) > 0 && parseInt(this.value) < 32 ? this.value : this.value.substring(0,this.value.length-1)) : this.value.substring(0,this.value.length-1))' onblur='var el = document.getElementById(\"#{object_name.to_s}_#{method.to_s}\");var k = el.value.split(\"-\");if(this.value){k[2]=this.value; el.value = k.join(\"-\")};'>
<select class='span2' onchange='var el = document.getElementById(\"#{object_name.to_s}_#{method.to_s}\");var k = el.value.split(\"-\");if(this.value){k[1]=this.value; el.value = k.join(\"-\")};'>"
["January","February","March","April","May","June","July","August","September","October","November","December"].each_with_index do |mon,index|
html = html + "<option value='#{(index < 9 ? "0" : "")}#{(index + 1).to_s}' #{(options[:value] && options[:value].month == (index + 1) ? "selected='selected'" : "")}>#{mon}</option>"
end
html = html + "</select><input type='text' class='span1' #{(options[:value] ? "value='#{options[:value].year}'" : "")} placeholder='Year' onkeypress='return (event.charCode >= 48 && event.charCode <= 57) || event.keyCode == 8 || event.keyCode == 46 || (event.keyCode >= 37 && event.keyCode <= 40) event.keyCode == 9' onkeyup='this.value=(this.value.length == 4 ? (parseInt(this.value) > 1900 && parseInt(this.value) < 3000 ? this.value : this.value.substring(0,this.value.length-1)) : (this.value.length > 4 ? this.value.substring(0,this.value.length-1) : this.value))' onblur='var el = document.getElementById(\"#{object_name.to_s}_#{method.to_s}\");var k = el.value.split(\"-\");if(this.value){k[0]=this.value; el.value = k.join(\"-\")};'>"
html = html + hidden_field(object_name, method, :value => options[:value] || "1901-01-01")
html = html + "</div>"
html.html_safe
end
def date_picker(object_name, method, options) def date_picker(object_name, method, options)
custom = {} custom = {}
custom[:format] = options[:format] || 'yyyy/MM' custom[:format] = options[:format] || 'yyyy/MM'
@ -103,6 +116,6 @@ module Orbit::FormBuilder
# ActionPack's metaprogramming would have done this for us, if FormHelper#labeled_input # ActionPack's metaprogramming would have done this for us, if FormHelper#labeled_input
# had been defined at load. Instead we define it ourselves here. # had been defined at load. Instead we define it ourselves here.
def datetime_picker(method, options = {}) def datetime_picker(method, options = {})
@template.datetime_picker(@object_name, method, objectify_options(options)) # @template.datetime_picker(@object_name, method, objectify_options(options))
end end
end end

View File

@ -1,12 +1,43 @@
module OrbitHelper module OrbitHelper
def self.set_params(params) def self.set_params(params,current_user)
@params = params @params = params
@current_user = current_user
end end
def self.set_page_categories(categories) def self.set_page_categories(categories)
@categories = categories; @categories = categories;
end end
def self.set_page_tags(tags)
@tags = tags;
end
def self.register_subpart(subpart_id)
subpart = SubPart.find(subpart_id) rescue nil
if !subpart.nil?
self.set_current_widget subpart
self.set_widget_data_count subpart.data_count
self.set_widget_categories subpart.categories
self.set_widget_module_app subpart.module
self.set_widget_item_url subpart
self.set_widget_title subpart.title
self.set_widget_categories subpart.categories || []
self.set_widget_tags subpart.tags || []
custom_value = subpart.custom_string_field || subpart.custom_array_field rescue nil
if !custom_value.nil?
self.set_widget_custom_value custom_value
end
end
end
def self.set_page_role_status(role_status)
@role_status = role_status;
end
def self.set_member_sort_position(sort_position)
@sort_position = sort_position;
end
def self.set_page_data_count(data_count) def self.set_page_data_count(data_count)
@data_count = data_count @data_count = data_count
end end
@ -30,6 +61,48 @@ module OrbitHelper
@categories @categories
end end
def self.page_tags
@tags
end
def self.page_role_status
@role_status
end
def self.member_sort_position
@sort_position
end
def self.current_user
@current_user
end
def self.page_for_tag(tag)
page_for_tag = nil
pages = Page.where(:module => @module_app.key)
pages.each do |page|
if page.tags.count ==1
if page.tags.include?(tag)
page_for_tag = page
end
end
break if !page_for_tag.nil?
end
if page_for_tag.nil?
pages.each do |page|
if page.tags.include?(tag)
page_for_tag = page
end
break if !page_for_tag.nil?
end
end
page_for_tag = pages.first if page_for_tag.nil?
'/'+I18n.locale.to_s+page_for_tag.url+'?tags[]='+tag.id.to_s
end
def self.this_module_app def self.this_module_app
@module_app @module_app
end end
@ -62,6 +135,45 @@ module OrbitHelper
@widget_title @widget_title
end end
def self.set_widget_tags(tags)
@widget_tags = tags
end
def self.widget_tags
@widget_tags
end
def self.user_can_edit?(obj)
return false if @current_user.nil?
return true if @current_user.is_admin?
return @current_user.nil? ? false : self.user_has_cateogry?(obj.category_id)
end
def self.user_access_level?
access_level = nil
if @current_user.nil?
access_level = "user"
elsif@current_user.is_admin?
access_level = "admin"
elsif @current_user.is_manager?(@module_app)
access_level = "manager"
elsif @current_user.is_sub_manager?(@module_app)
access_level = "sub_manager"
end
access_level
end
def self.user_has_cateogry?(cat)
return false if @current_user.nil?
if @current_user.is_admin? or @current_user.is_manager?(@module_app)
return true
else
category = Category.find(cat) rescue nil
return false if category.nil?
return @current_user.approved_categories.include?category rescue false
end
end
def self.params def self.params
@params @params
end end
@ -80,9 +192,38 @@ module OrbitHelper
@url_to_plugin_show = "#{page.url}/#{slug}" rescue "#" @url_to_plugin_show = "#{page.url}/#{slug}" rescue "#"
end end
def self.override_widget_module_app(module_app)
self.set_widget_module_app module_app
@url_widget_for_show = ""
pages = Page.where(:module => module_app)
widget_categories = self.get_current_widget.categories rescue []
finalpage = nil
pages.each do |p|
if p.categories == widget_categories
finalpage = p
end
break if !finalpage.nil?
end
if finalpage.nil?
pages.each do |p|
if self.array_include(p.categories, widget_categories)
finalpage = p
end
break if !finalpage.nil?
end
end
finalpage = pages.first if finalpage.nil?
if !finalpage.nil?
@url_widget_for_show = "/#{@site_locale.to_s}#{finalpage.url}"
end
end
def self.set_widget_item_url(widget) def self.set_widget_item_url(widget)
@url_widget_for_show = "" @url_widget_for_show = ""
module_app = widget.module module_app = widget.module
module_app = self.widget_module_app.key if module_app.nil?
pages = Page.where(:module => module_app) pages = Page.where(:module => module_app)
widget_categories = widget.categories widget_categories = widget.categories
finalpage = nil finalpage = nil
@ -126,6 +267,14 @@ module OrbitHelper
"#{request.host_with_port}/#{locale}#{url}" "#{request.host_with_port}/#{locale}#{url}"
end end
def self.set_request_object(request)
@site_request_object = request
end
def self.request
@site_request_object
end
def self.set_site_locale(locale) def self.set_site_locale(locale)
@site_locale = locale @site_locale = locale
end end
@ -139,7 +288,14 @@ module OrbitHelper
end end
def self.set_widget_categories(categories) def self.set_widget_categories(categories)
@widget_categories = categories @widget_categories = []
categories.each do |c|
category = Category.find(c) rescue nil
if !category.nil? && !category.disable
@widget_categories << c
end
end
@widget_categories = ["all"] if @widget_categories.blank?
end end
def self.widget_categories def self.widget_categories
@ -158,6 +314,14 @@ module OrbitHelper
@controller_name = name @controller_name = name
end end
def self.set_current_widget(widget)
@current_widget = widget
end
def self.get_current_widget
@current_widget
end
def get_item_module_infos(page) def get_item_module_infos(page)
if page.parent_page_id.nil? if page.parent_page_id.nil?
["Home","icons-house"] ["Home","icons-house"]
@ -183,6 +347,113 @@ module OrbitHelper
!$mobile.blank? !$mobile.blank?
end end
def self.set_css_to_render_to_empty
@css_to_render_in_head = []
end
def self.render_css_in_head(css=[])
@css_to_render_in_head.concat(css)
end
def self.get_css_to_render_in_head
css_html = ""
@css_to_render_in_head.each do |css|
css_html = css_html + "<link rel='stylesheet' media='screen' href='/assets/#{css}'>\n"
end
return css_html
end
def self.render_meta_tags(metas=[])
@page_meta_tags = metas
end
def self.meta_tags_html
html = ""
if !@page_meta_tags.nil?
@page_meta_tags.each do |meta|
html = html + "<meta "
meta.keys.each do |attrib|
html = html + "#{attrib}='#{self.strip_html_tags(meta[attrib])}' "
end
html = html + ">"
end
end
html
end
def self.strip_html_tags(string)
ActionView::Base.full_sanitizer.sanitize(string)
end
# get feeds for the module
def self.get_feed_for_module(type)
if ModuleApp.where(:key => "feed").count == 0
return []
end
categories = []
ma = nil
if type == "index"
categories = @categories if !@categories.nil?
ma = @module_app
elsif type == "widget"
categories = @widget_categories if !@widget_categories.nil?
ma = @widget_module_app
end
if categories.first == "all"
feeds = SiteFeed.where(:channel_key => ma.key).enabled
else
feeds = SiteFeed.where(:channel_key => ma.key, :merge_with_category.in => categories).enabled
end
data = []
if feeds.count > 0
temp_ids = []
feeds.each do |feed|
file = File.join(Rails.root,"public","site_feeds",feed.id.to_s,feed.feed_uid.to_s + ".json")
if File.exists?(file)
d = File.read(file)
d = JSON.parse(d)
cat = Category.find(feed.merge_with_category).title
final_d = []
d[ma.key.pluralize].each{|a|
a["category"] = cat
if !temp_ids.include?(a["id"])
temp_ids << a["id"]
a["params"] = a["params"] + "_" + feed.id.to_s + "h"
final_d << a
end
}
data.concat(final_d)
end
end
end
data
end
def self.is_object_from_feed?(uid)
return uid.ends_with?("h")
end
def self.get_from_feed(uidwithid)
temp = uidwithid.split("_")
feed_id = temp[1][0...-1]
uid = temp[0]
object = nil
feed = SiteFeed.find(feed_id) rescue nil
if !feed.nil?
file = File.join(Rails.root,"public","site_feeds",feed.id.to_s,feed.feed_uid.to_s + ".json")
if File.exists?(file)
d = File.read(file)
d = JSON.parse(d)
objects = d[@module_app.key.pluralize]
object = objects.select{|obj| obj["id"] == uid}.first
cat = Category.find(feed.merge_with_category)
object = {} if cat.disable
end
end
object
end
# =============================================================== # ===============================================================
# Breadcrumbs # Breadcrumbs
# =============================================================== # ===============================================================
@ -203,25 +474,33 @@ module OrbitHelper
else else
res << "<li class='active'>#{params[:type].underscore.humanize.capitalize} #{t(:authorization_)}</li>" res << "<li class='active'>#{params[:type].underscore.humanize.capitalize} #{t(:authorization_)}</li>"
end end
when 'images'
id = AlbumImage.find(params[:id]).album.id.to_s rescue ""
res << "<li><a href='/admin/galleries/#{id}'>#{t('module_name.'+@module_app.key)}</a>#{divider}</li>"
res << "<li class='active'>#{t(:theater)}</li>"
when 'categories' when 'categories'
if @module_app.key!='category' if @module_app.key!='category'
res << "<li>#{@module_app.title}#{divider}</li>" res << "<li>#{t('module_name.'+@module_app.key)}#{divider}</li>"
res << "<li class='active'>#{t(:categories)}</li>" res << "<li class='active'>#{t(:categories)}</li>"
else else
res << "<li class='active'>#{@module_app.title}</li>" res << "<li class='active'>#{t('module_name.category')}</li>"
end end
when 'tags' when 'tags'
if @module_app.key!='tag' if @module_app.key!='tag'
res << "<li>#{@module_app.title}#{divider}</li>" res << "<li>#{t('module_name.'+@module_app.key)}#{divider}</li>"
res << "<li class='active'>#{t(:tags)}</li>" res << "<li class='active'>#{t(:tags)}</li>"
else else
res << "<li class='active'>#{@module_app.title}</li>" res << "<li class='active'>#{t('module_name.tag')}</li>"
end end
else else
if params[:action].eql?('index') if params[:action].eql?('index')
res << "<li>#{@module_app.title}</li>" res << "<li>#{t('module_name.'+@module_app.key)}</li>"
else else
res << "<li><a href='/#{params[:controller]}'>#{@module_app.title}</a>#{divider}</li>" if params[:controller] == "admin/ad_images"
res << "<li><a href='/admin/ad_banners'>#{t('module_name.'+@module_app.key)}</a>#{divider}</li>"
else
res << "<li><a href='/#{params[:controller]}'>#{t('module_name.'+@module_app.key)}</a>#{divider}</li>"
end
res << "<li class='active'>#{t(params[:action], scope: 'restful_actions')}</li>" res << "<li class='active'>#{t(params[:action], scope: 'restful_actions')}</li>"
end end
end end

View File

@ -11,8 +11,8 @@ module PagesHelper
doc.to_html doc.to_html
end end
def render_widget_for_frontend(controller_name, widget_method, widget_file) def render_widget_for_frontend(controller_name, widget_method, widget_file, subpart_id=nil)
def parsing_repeats_again(elements,d,level) def widget_parsing_repeats_again(elements,d,level)
newhtml = [] newhtml = []
oldhtml = [] oldhtml = []
elements.each do |el| elements.each do |el|
@ -23,7 +23,7 @@ module PagesHelper
d["#{data_name}"].each_with_index do |item,i| d["#{data_name}"].each_with_index do |item,i|
element = el.inner_html element = el.inner_html
if wrap_elements.count > 0 if wrap_elements.count > 0
htmls = parsing_repeats_again(wrap_elements,d["#{data_name}"][i], level + 1) htmls = widget_parsing_repeats_again(wrap_elements,d["#{data_name}"][i], level + 1)
htmls[0].each_with_index do |html,i| htmls[0].each_with_index do |html,i|
element = element.gsub(html,htmls[1][i]) element = element.gsub(html,htmls[1][i])
end end
@ -45,12 +45,18 @@ module PagesHelper
end end
[oldhtml,newhtml] [oldhtml,newhtml]
end end
@key = Site.first.template if @key.nil?
controller_name = controller_name.downcase.singularize controller_name = controller_name.downcase.singularize
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', "#{controller_name}", "_#{widget_file}.html.erb"); f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', "#{controller_name}", "_#{widget_file}.html.erb");
if !File.exists?f if !File.exists?f
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'widgets', "#{controller_name}", "_#{widget_file}.html.erb"); f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'widgets', "#{controller_name}", "_#{widget_file}.html.erb");
if !File.exists?f if !File.exists?f
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', "#{controller_name}", "_widget.html.erb");
if File.exists?f
f = File.join('../templates', "#{@key}", 'modules', "#{controller_name}", "_widget.html.erb"); f = File.join('../templates', "#{@key}", 'modules', "#{controller_name}", "_widget.html.erb");
else
return "<div class='well'>Maybe the administrator has changed the theme, please select the widget design again from the page settings.</div>".html_safe
end
else else
f = File.join('../templates', "#{@key}", 'widgets', "#{controller_name}", "_#{widget_file}.html.erb"); f = File.join('../templates', "#{@key}", 'widgets', "#{controller_name}", "_#{widget_file}.html.erb");
end end
@ -59,26 +65,79 @@ module PagesHelper
end end
s = render_to_string(f) s = render_to_string(f)
doc = Nokogiri::HTML(s, nil, "UTF-8") doc = Nokogiri::HTML(s, nil, "UTF-8")
if !subpart_id.nil?
doc.css("body").children.first.set_attribute("data-subpart-id", subpart_id) rescue nil
end
wrap_elements = doc.css("*[data-repeat]") wrap_elements = doc.css("*[data-repeat]")
controller = "#{controller_name.capitalize.pluralize}_controller".classify.constantize.new controller = "#{controller_name.capitalize.pluralize}_controller".classify.constantize.new
OrbitHelper.set_current_widget_module controller_name OrbitHelper.set_current_widget_module controller_name
data = controller.send("#{widget_method}") begin
keys = data.keys data = controller.send("#{widget_method}") #rescue nil
rescue Exception => e
write_widget_debug_file(e,controller_name,widget_method,subpart_id)
end
if !data.nil?
wrap_elements = doc.css("*[data-list][data-level='0']") wrap_elements = doc.css("*[data-list][data-level='0']")
htmls = parsing_repeats_again(wrap_elements,data,1) htmls = widget_parsing_repeats_again(wrap_elements,data,1)
html = doc.to_s html = doc.to_s
htmls[0].each_with_index do |h,i| htmls[0].each_with_index do |h,i|
html = html.gsub(h,htmls[1][i]) html = html.gsub(h,htmls[1][i])
end end
if keys[1] extras = data['extras'] || {}
extras = (data[keys[1]].kind_of?(Array) ? data[keys[0]] : data[keys[1]])
extras["widget-title"] = OrbitHelper.widget_title extras["widget-title"] = OrbitHelper.widget_title
extras.each do |key,value| extras.each do |key,value|
html = html.gsub("{{#{key}}}",value.to_s.html_safe) html = html.gsub("{{#{key}}}",value.to_s.html_safe)
html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s) html = html.gsub("%7B%7B#{key}%7D%7D",value.to_s)
end end
end
html.html_safe html.html_safe
else
return "<div class='well'>No content to show.</div>".html_safe
end
end
def write_widget_debug_file(e,controller_name,action_name,sub_part)
url_dir_name = request.fullpath.split("?")[0]
url_dir_name = URI.decode(url_dir_name)
url_dir_name = (url_dir_name == "/" ? "home" : url_dir_name.sub("/","").gsub("/","_").gsub("-","_").gsub(" ","_"))
directory_name = "tmp/debug/#{url_dir_name}"
FileUtils.mkdir_p(directory_name) unless File.exists?(directory_name)
fn = "#{directory_name}/#{controller_name}_#{action_name}_#{(sub_part if !sub_part.nil?)}.html"
error_trace_spans = ""
e.backtrace.each do |bt|
error_trace_spans = error_trace_spans + "<span>#{bt}</span><br />"
end
con = "#{controller_name.capitalize.pluralize}_controller".classify.constantize
File.open(fn, "w"){ |file|
file.puts "<html>
<head>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
<meta charset=UTF-8'>
<title>Debug result</title>
</head>
<body>
<h3>Error Message</h3>
<div class='error-message'>
<h2><i>#{e.message}</i></h2>
</div>
<h3>Request Details</h3>
<div class='request-details'>
<span>Url : <b>#{URI.decode(request.url)}</b></span><br />
<span>Controller : <b>#{con.to_s}</b></span><br />
<span>Action : <b>#{action_name.capitalize}</b></span><br />
<span>SubPart Id : <b>#{sub_part}</b></span>
</div>
<h3>Error Trace</h3>
<div class='error-trace'>
#{error_trace_spans}
</div>
<h3>Params</h3>
<div class='params'>
#{OrbitHelper.params}
</div>
</body>
</html>"
}
end end
end end

View File

@ -29,9 +29,16 @@ class OrbitMailer < ActionMailer::Base
unless email.email_files.blank? unless email.email_files.blank?
email.email_files.each_with_index do |email_file, i| email.email_files.each_with_index do |email_file, i|
unless email_file.file.blank?
if !email_file.title.blank?
file_type = File.extname(email_file.file.to_s) file_type = File.extname(email_file.file.to_s)
file_content = File.read(email_file.file.url) # file_content = File.read(email_file.file.url)
attachments["#{email_file.title}#{file_type}"] = file_content.read attachments["#{email_file.title}#{file_type}"] = email_file.file.read
else
file_name = File.basename(email_file.file.path)
attachments["#{file_name}"] = email_file.file.read
end
end
end end
end end
@ -62,6 +69,8 @@ class OrbitMailer < ActionMailer::Base
mail_log.save mail_log.save
email.destroy
end end
end end

View File

@ -69,10 +69,6 @@ class AttributeField
end end
def role
self.attribute.role
end
def panel def panel
panel = LIST[:markups][self[:markup]]["panel"] panel = LIST[:markups][self[:markup]]["panel"]
end end
@ -105,8 +101,16 @@ class AttributeField
if field_status.eql?(true) if field_status.eql?(true)
@attribute_field_counter = role.attribute_fields.count rescue nil @attribute_field_counter = role.attribute_fields.count rescue nil
@attribute_field = self.find(attribute_field_id) rescue nil @attribute_field = self.find(attribute_field_id) rescue nil
old_key = @attribute_field.key
@attribute_field.update(role_param) @attribute_field.update(role_param)
@attribute_field.save @attribute_field.save
attribute_values = @attribute_field.attribute_values
if attribute_values.count > 0
attribute_values.each do |av|
av.key = role_param["key"]
av.save
end
end
@attribute_field[:af_count] = @attribute_field_counter @attribute_field[:af_count] = @attribute_field_counter
else else
@attribute_field_counter = role.attribute_fields.count rescue nil @attribute_field_counter = role.attribute_fields.count rescue nil

View File

@ -44,6 +44,47 @@ class AttributeValue
self[:temp_data] = value self[:temp_data] = value
end end
def get_field_value
if (self.attribute_field.markup.eql?("text_field") || self.attribute_field.markup.eql?("text_area"))
field_value = self.value[I18n.locale].gsub("\r\n","<br>")
elsif (self.attribute_field.markup.eql?("select") || self.attribute_field.markup.eql?("radio_button"))
field_value = self.attribute_field.markup_value["#{self.value}"][I18n.locale] rescue nil
elsif self.attribute_field.markup.eql?("address")
field_value = rf[:address_key][I18n.locale].map{|k,v| v}.delete_if(&:blank?).join(', ')
elsif self.attribute_field.markup.eql?("date")
case self.attribute_field.typeC['format']
when 'format1'
field_value = self.value.to_date.strftime("%Y/%m/%d")
when 'format2'
field_value = self.value.to_date.strftime("%Y/%m/%d")
when 'format3'
field_value = self.value.to_date.strftime("%Y/%m")
when 'format4'
field_value = self.value.to_date.strftime("%Y")
end
elsif self.attribute_field.markup.eql?("checkbox")
field_value = self.value.map {|v| self.attribute_field.markup_value["#{v}"][I18n.locale]}.join(', ') rescue nil
end
field_value = (field_value =~ /\A#{URI::regexp(['http', 'https'])}\z/) ? "<a href='#{field_value}' target='blank'>#{field_value}</a>" : field_value
field_value = (field_value =~ /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i) ? "<a href='mailto:#{field_value}'>#{field_value}</a>" : field_value
if !field_value.blank?
{
"key" => self.attribute_field.key,
"title" => self.attribute_field.title,
"value" => field_value,
"val" => field_value = self.value
}
else
{
"key" => self.attribute_field.key,
"title" => self.attribute_field.title,
"value" => "&nbsp;",
"val" => field_value = self.value
}
end
end
def get_value_by_locale(locale,add_more_index=nil) def get_value_by_locale(locale,add_more_index=nil)
case self.attribute_field.markup case self.attribute_field.markup
@ -158,7 +199,7 @@ def unset_all_lang_values
end #of data_proc end #of data_proc
def check_key def check_key
self.key = attribute_field.key self.key = self.attribute_field.key
end end
def method_missing(*field) def method_missing(*field)

View File

@ -23,6 +23,7 @@ class Authorization
end end
end end
def self.category_role_sub_managers(category) def self.category_role_sub_managers(category)
authorizations = self.category_authorized_users(category) authorizations = self.category_authorized_users(category)
users = authorizations.map { |a| a.role if role.present? } users = authorizations.map { |a| a.role if role.present? }
@ -32,7 +33,7 @@ class Authorization
user = User.find(user_id) user = User.find(user_id)
workgroup = Workgroup.find_by(key: "managers") workgroup = Workgroup.find_by(key: "managers")
module_app = ModuleApp.find(module_app_id) module_app = ModuleApp.find(module_app_id)
if (user.is_admin? || user.is_manager?(module_app) || user.is_sub_manager?(module_app)|| user.is_manager_with_role?(module_app)) if (user.is_admin? || user.is_manager?(module_app) || user.is_manager_with_role?(module_app))
puts "User Already Authorized" puts "User Already Authorized"
else else
a = self.create(module_app_id: module_app_id, user_id: user_id, workgroup_id: workgroup.id) a = self.create(module_app_id: module_app_id, user_id: user_id, workgroup_id: workgroup.id)
@ -44,13 +45,9 @@ class Authorization
user = User.find(user_id) user = User.find(user_id)
workgroup = Workgroup.find_by(key: "sub_managers") workgroup = Workgroup.find_by(key: "sub_managers")
module_app = ModuleApp.find(module_app_id) module_app = ModuleApp.find(module_app_id)
if (user.is_admin? || user.is_manager?(module_app) || user.is_sub_manager?(module_app) || user.is_manager_with_role?(module_app))
puts "User Already Authorized"
else
a = self.create(category_id: category_id, user_id: user_id, workgroup_id: workgroup.id) a = self.create(category_id: category_id, user_id: user_id, workgroup_id: workgroup.id)
a.save a.save
end end
end
def self.create_module_authorization_with_role(module_app_id,role_id) def self.create_module_authorization_with_role(module_app_id,role_id)
current_auth = self.where(role_id: role_id, module_app_id: module_app_id) current_auth = self.where(role_id: role_id, module_app_id: module_app_id)
@ -77,12 +74,22 @@ class Authorization
end end
def self.remove_module_authorization(module_app_id,user_id) def self.remove_module_authorization(module_app_id,user_id)
auth = self.find_by(module_app_id: module_app_id, user_id: user_id) auth = self.find_by(module_app_id: module_app_id, user_id: user_id) rescue nil
auth.delete auth.destroy if !auth.nil?
end end
def self.remove_category_authorization(category_id,user_id) def self.remove_category_authorization(category_id,user_id)
auth = self.find_by(category_id: category_id, user_id: user_id) auth = self.find_by(category_id: category_id, user_id: user_id) rescue nil
auth auth.destroy if !auth.nil?
end
def self.remove_module_authorization_with_role(module_app_id,role_id)
auth = self.find_by(module_app_id: module_app_id, role_id: role_id) rescue nil
auth.destroy if !auth.nil?
end
def self.remove_category_authorization_with_role(category_id,role_id)
auth = self.find_by(category_id: category_id, role_id: role_id) rescue nil
auth.destroy if !auth.nil?
end end
end end

View File

@ -10,7 +10,16 @@ class Category
scope :enabled, ->{ where(:disable.in => [false, nil, ''])} scope :enabled, ->{ where(:disable.in => [false, nil, ''])}
validates :title, presence: true
def category_sub_managers def category_sub_managers
Authorization.category_authorized_users(self).pluck(:user_id) Authorization.category_authorized_users(self).pluck(:user_id)
end end
def self.authorized(user)
module_app_categories = self.each{|c| c}.to_a rescue []
authorized_categories = user.approved_categories
intersection = (module_app_categories & authorized_categories)
intersection
end
end end

View File

@ -20,6 +20,7 @@ class Email
field :update_user_id field :update_user_id
has_many :email_files, :autosave => true, :dependent => :destroy has_many :email_files, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :email_files, :allow_destroy => true
scope :can_deliver, ->{ where(:mail_sentdate.lte => Time.now, :is_sent=>false) } scope :can_deliver, ->{ where(:mail_sentdate.lte => Time.now, :is_sent=>false) }

Some files were not shown because too many files have changed in this diff Show More