Merge commit '43ecebf93482cf94c73b78564509d1a352c2bcd2' into app_config

This commit is contained in:
Matthew K. Fu JuYuan committed 2012-09-18 16:30:34 +08:00
commit 2321116597
601 files changed
+25582 -2546

No files matched your search

@@ -2,15 +2,16 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
include AdminHelper
include OrbitControllerLib::DivisionForDisable
layout 'new_admin'
before_filter :authenticate_user!
# before_filter :for_admin_only,:only => [:]
# before_filter :for_app_manager,:only => [:index,:show,]
before_filter :force_order_for_visitor,:only=>[:index,:show,:get_sorted_and_filtered_bulletins]
before_filter :force_order_for_user,:except => [:index,:show,:get_sorted_and_filtered_bulletins]
before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_bulletins]
before_filter :only => [ :new,:create,:edit,:update,:create] do |controller|
controller.get_categorys('BulletinCategory')
end
# before_filter :for_admin_only,:only => [:]
# before_filter :for_app_manager,:only => [:index,:show,]
before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_bulletins]
def index
# @bulletins = Bulletin.all
# @bulletins = Bulletin.desc("postdate desc")
@@ -1,6 +1,6 @@
<tr id="<%= dom_id bulletin %>" class="with_action">
<td>
<% if (bulletin.create_user_id == current_user.id) || is_manager? %>
<% if (bulletin.create_user_id == current_or_guest_user.id) || is_manager? %>
<%= check_box_tag 'to_delete[]', bulletin.id, false, :class => "checkbox_in_list" %>
<% end -%>
</td>
@@ -33,9 +33,9 @@
<%= show_bulletin_title_at_index bulletin%>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<% if (bulletin.create_user_id == current_user.id) || is_manager? %>
<% if (bulletin.create_user_id == current_or_guest_user.id) || is_manager? %>
<% if current_user.admin? || (!bulletin.is_rejected? && !bulletin.is_checked?) %>
<% if current_or_guest_user.admin? || (!bulletin.is_rejected? && !bulletin.is_checked?) %>
<li><%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li>
<li class="dropdown">
<a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a>
@@ -43,7 +43,7 @@
<li><%= link_to t(:basic), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'basic'), :remote => true %></li>
<li><%#= link_to t(:picture), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'picture'), :remote => true %></li>
<li><%= link_to t(:tags), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'tags'), :remote => true %></li>
<li><%#= link_to t(:link), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'links'), :remote => true %></li>
<li><%= link_to t(:link), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'links'), :remote => true %></li>
<li><%#= link_to t(:file), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li>
</ul>
</li>
@@ -1,3 +1,3 @@
<div class="filter-clear">
<%= link_to content_tag(:i, nil, :class => 'icons-brush-large') + t(:clear), panel_announcement_back_end_bulletins_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn js_history" %>
<%= link_to content_tag(:i, nil, :class => 'icons-brush-large') + t(:clear), panel_announcement_back_end_bulletins_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn btn-small js_history" %>
</div>
@@ -1,6 +1,6 @@
<div class="accordion-inner" data-toggle="buttons-checkbox">
<% @bulletin_categories.each do |category| -%>
<%= link_to category.title, panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %>
<%= link_to category.title, panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('categories', category.id)}" %>
<% end -%>
</div>
<%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %>
@@ -1,9 +1,9 @@
<div class="accordion-inner" data-toggle="buttons-checkbox">
<%= link_to t(:top), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_top'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('status', 'is_top')}" %>
<%= link_to t(:hot), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hot'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('status', 'is_hot')}" %>
<%= link_to t(:hidden), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hidden'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('status', 'is_hidden')}" %>
<%= link_to t(:pending), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_pending'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('status', 'is_pending')}" %>
<%= link_to t(:passed), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_checked'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('status', 'is_checked')}" %>
<%= link_to t(:rejected), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_rejected'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('status', 'is_rejected')}" %>
<%= link_to t(:top), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_top'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_top')}" %>
<%= link_to t(:hot), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hot'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_hot')}" %>
<%= link_to t(:hidden), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_hidden'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_hidden')}" unless(is_guest?)%>
<%= link_to t(:pending), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_pending'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_pending')}" if(is_manager?)%>
<%= link_to t(:passed), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_checked'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_checked')}" if(is_manager?)%>
<%= link_to t(:rejected), panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'status', :id => 'is_rejected'}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('status', 'is_rejected')}" if(is_manager?)%>
</div>
<%= render :partial => 'clear_filters', :locals => {:type => 'status'} %>
@@ -1,6 +1,6 @@
<div class="accordion-inner" data-toggle="buttons-checkbox">
<% @tags.each do |tag| -%>
<%= link_to tag[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('tags', tag.id)}" %>
<%= link_to tag[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'tags', :id => tag.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn btn-small js_history#{is_filter_active?('tags', tag.id)}" %>
<% end -%>
</div>
<%= render :partial => 'clear_filters', :locals => {:type => 'tags'} %>
@@ -212,17 +212,56 @@
<p><%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %></p>
<p><%= t("sys.preview_only_for_img") %></p>
</div>
<fieldset>
<input type="hidden" id="MAX_FILE_SIZE" name="MAX_FILE_SIZE" value="300000" />
<div id="filedrag">
<div class="point">Drop files here
<span>or</span>
<label class="file-select" for="fileselect">select from a folder
<!-- <input type="file" class="upload" id="fileselect" name="fileselect[]" multiple="multiple" /> -->
<%= f.fields_for @bulletin.bulletin_files.build, do |f| %>
<%= f.file_field :file, :multiple => true, :class => 'upload', :id => 'fileselect' %>
<% end %>
</label>
</div>
</div>
<div id="submitbutton">
<button type="submit">Upload Files</button>
</div>
</fieldset>
<div>
<table class="table table-condensed">
<thead>
<tr>
<th>File Name</th>
<th class="span2">Chinese</th>
<th class="span2">English</th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td>File Name</td>
<td><input type="checkbox" id="optionsCheckbox" value="true" disabled /></td>
<td><input type="checkbox" id="optionsCheckbox" value="true" disabled checked /></td>
<td><a class="action" data-toggle="modal" href="#modal-link"><i class="icon-pencil"></i></a><a class="action" href=""><i class="icon-remove"></i></a></td>
</tr>
</tfoot>
<tbody id="messages">
</tbody>
</table>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %>
<%# @bulletin.bulletin_files.each_with_index do |bulletin_file, i| %>
<%#= fields_for "bulletin[bulletin_files][]", bulletin_file do |f| %>
<%= f.fields_for :bulletin_files, bulletin_file do |f| %>
<%= render :partial => 'form_bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<%#= f.fields_for :bulletin_files do |f| %>
<%#= render :partial => 'form_bulletin_file', :object => bulletin_file, :locals => {:f => f, :i => i} %>
<%# end %>
<%# end %>
</tbody>
</table>
@@ -4,7 +4,7 @@
</table>
<div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary pull-right' %>
<%= link_to(content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary pull-right' )if (is_manager? rescue nil)%>
<div id="bulletin_pagination" class="paginationFixed">
<%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %>
</div>
@@ -0,0 +1,6 @@
.bundle/
log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/log/*.log
test/dummy/tmp/
+17
View File
@@ -0,0 +1,17 @@
source "http://rubygems.org"
# Declare your gem's dependencies in calendar.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# jquery-rails is used by the dummy application
gem "jquery-rails"
# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
+20
View File
@@ -0,0 +1,20 @@
Copyright 2012 YOURNAME
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+3
View File
@@ -0,0 +1,3 @@
= Calendar
This project rocks and uses MIT-LICENSE.
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env rake
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
begin
require 'rdoc/task'
rescue LoadError
require 'rdoc/rdoc'
require 'rake/rdoctask'
RDoc::Task = Rake::RDocTask
end
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Calendar'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'
Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end
task :default => :test
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,210 @@
//created on sep 14 2012
var calendarAPI = function(){
c = this;
this.event_create_div = $("#event_create");
this.event_quick_view_div = $("#event_quick_view");
this.cur_month = null;
this.cur_year = null;
this.today = new Date();
this.monthlist = ["","January","February","March","April","May","June","July","August","September","October","November","December"];
this.initialize = function(){
$(window).load(function(){
c.loadMonthView();
bindHandlers();
})
var bindHandlers = function(){
$(".event").live("click",function(){
c.displayEvent();
})
$("#create_event_btn").click(function(){
if(!$(this).hasClass("active")){
c.newEvent($(this).attr("href"),$(this).attr("ref"),c.today.getDate(),c.today.getMonth()+1,c.today.getFullYear());
}else{
c.event_create_div.hide().empty();
}
$(this).toggleClass("active");
return false;
})
$("td.click_event").live("click",function(){
c.newEvent($(this).attr("link"),$(this).attr("ref"),$(this).attr("date"),c.cur_month,c.cur_year);
$("#create_event_btn").toggleClass("active");
})
$('.mode_switch').click(function(){
var target = $(this).text();
switch(target){
case 'month':
c.loadMonthView(c.cur_month,c.cur_year);
break;
case 'week':
c.loadWeekView();
break;
case 'day':
c.loadDayView();
break;
case 'agenda':
c.loadAgendaView();
break;
}
})
$("button#prev_month_btn").click(function(){
var m,y;
if(c.cur_month == 1){
m = 12;
y = c.cur_year-1;
}else{
m = c.cur_month-1;
y = c.cur_year;
}
c.loadMonthView(m,y);
})
$("button#next_month_btn").click(function(){
var m,y;
if(c.cur_month == 12){
m = 1;
y = c.cur_year+1;
}else{
m = c.cur_month+1;
y = c.cur_year;
}
c.loadMonthView(m,y);
})
$("button#today_btn").click(function(){
c.loadMonthView();
})
}
}
this.loadMonthView = function(month,year){
if(!month){
var dt = new Date();
month = dt.getMonth()+1;
year = dt.getFullYear();
}
// month = 2;
// year = 2008;
c.cur_month = month;
c.cur_year = year;
$('#view_holder').load("cals/month_view?month="+month+"&year="+year, function() {
getEvents(month,year);
$('.current_day_title').text(c.monthlist[c.cur_month]+" "+c.cur_year);
if($('#calendar_month').length > 0){
var $c_table = $('#calendar_month');
var sum_h = 0;
var context_h = $('#main-sidebar').outerHeight();
$('#main-wrap > *').not('#orbit_calendar, .modal').each(function(){
sum_h += $(this).outerHeight();
});
$c_table
// .height(context_h-sum_h-64)
.find('.month_row')
.not('.month_row.header')
.height((context_h-sum_h-92) / 6);
$(window).resize(function(){
$c_table
.find('.month_row')
.not('.month_row.header')
.height(($('#main-sidebar').outerHeight()-sum_h-92) / 6);
});
}
})
var getEvents = function(month,year){
$.getJSON("cals/getEvents",{"type":"monthview","month":month,"year":year},function(events){
var $eventrow = $("<tr></tr>");
var nos = new Array();
nos.push(0);
$.each(events,function(i,evnt){
var daydom = $("#calendar_month td[date="+evnt.start_date+"]");
var curparent = daydom.parent().parent().parent();
var thisrow = curparent.attr("row");
var pos = daydom.attr("position");
var thisno = daydom.attr("no");
var index = "new";
for(x in nos){
if(thisno < nos[x]){
$eventrow = null;
$eventrow = $("<tr></tr>");
index = x;
break;
}
}
if(index!="new"){
nos[index] = (thisno + evnt.total_days) - 1;
}else{
nos.push((thisno + evnt.total_days) - 1);
}
if(pos == 1){
$eventrow.html('<td colspan="'+evnt.total_days+'"><div class="event" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>');
}else{
if($eventrow.html()==""){
$eventrow.append('<td colspan="'+(pos-1)+'">');
}
$eventrow.append('<td colspan="'+evnt.total_days+'"><div class="event" style="background-color: '+evnt.color+';">'+evnt.title+'</div></td>');
}
curparent.append($eventrow);
})
})
}
}
this.loadWeekView = function(){
$('#view_holder').load("cals/week_view", function() {
$('.current_day_title').text('September 2 - 8, 2012');
})
}
this.loadDayView = function(){
$('#view_holder').load("cals/day_view", function() {
$('.current_day_title').text('September 2, 2012');
})
}
this.loadAgendaView = function(){
$('#view_holder').load("cals/week_view", function() {
$('.current_day_title').text('September 2, 2012');
})
}
this.newEvent = function(url,ref,date,month,year){
var bindHandlers = function(){
c.event_create_div.find("button.btn-close").click(function(){
c.event_create_div.hide().empty();
$("#create_event_btn").removeClass("active");
})
c.event_create_div.find("input[for=all_day][type=checkbox]").click(function(){
if($(this).is(":checked"))
c.event_create_div.find("#non_all_day").hide()
else
c.event_create_div.find("#non_all_day").show()
})
}
c.event_create_div.load(url+"?ref="+ref+"&date="+date+"&month="+month+"&year="+year,function(){
c.event_create_div.show();
bindHandlers();
})
}
this.newCalendars = function(){
if($('.color-picker').length > 0){
$('.color-picker').miniColors(); // just in category view
}
$(".btn-del-a").live("ajax:success",function(){
var domfor = $(this).attr("data-content");
$("tr[for="+domfor+"]").remove();
})
}
this.displayEvent = function(){
c.event_quick_view_div.show()
}
c.initialize();
}
@@ -0,0 +1,293 @@
/* orbit calendar */
#orbit_calendar {
padding: 10px 8px;
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
}
.calendar_color_tag {
display: inline-block;
width: 18px;
height: 18px;
margin-right: 4px;
vertical-align: bottom;
}
.current_day_title {
text-align: center;
line-height: 28px;
}
.calendar_mode {
float: right;
z-index: 2;
}
.mode_switch {
text-transform: capitalize;
}
.today {
background-color: #D9EDF7;
}
.event {
font-size: 12px;
border-radius: 3px;
cursor: pointer;
padding: 1px 3px;
box-shadow: inset 0 0 1px black;
-webkit-box-shadow: inset 0 0 1px black;
-moz-box-shadow: inset 0 0 1px black;
}
.event_list .cell {
height: 38px;
border: solid 1px #ddd;
border-top: 0;
}
.event_list .divide {
height: 18px;
margin-bottom: 18px;
border-bottom: solid 1px #eee;
}
.event_list .day_time {
height: 30px;
border-bottom: solid 1px #ddd;
border-left: solid 1px #ddd;
text-align: right;
padding: 4px;
}
.event dl, .event dt, .event dd {
margin: 0;
padding: 0;
}
.event dl {
padding: 3px;
}
.event dt {
font-size: 11px;
font-weight: normal;
line-height: 12px;
}
#calendar_day .event_holder {
width: 100%;
height: 100%;
position: absolute;
top: 0;
z-index: 1;
}
.event_holder .inner {
position: relative;
margin: 0 16px 0 2px;
}
.event_holder .event {
padding: 0px;
position: absolute;
width: 100%;
}
.event_holder .event.half {
}
.event_holder .event.over {
border: solid 1px #fff;
}
/* month view */
#calendar_month {
border-bottom: solid 1px #ddd;
}
#calendar_month .month_row {
position: relative;
border: solid 1px #ddd;
border-bottom: 0;
height: 60px;
overflow: hidden;
}
#calendar_month .month_row .table {
table-layout: fixed;
margin-bottom: 0;
width: 100%;
position: absolute;
}
#calendar_month .month_row .table td {
border: 0;
border-left: solid 1px #ddd;
padding: 2px 4px 0 4px;
}
#calendar_month .month_row .table td:first-child {
border-left: 0;
}
#calendar_month .month_row.header {
height: 28px;
border: 0;
}
#calendar_month .month_row.header th {
font-size: 12px;
padding: 4px;
border: 0;
}
#calendar_month .month_row .month_table {
height: 100%;
}
#calendar_month .month_row .month_date {
color: #666;
font-size: 11px;
cursor: pointer;
}
#calendar_month .month_row .month_date td {
border-left: 0
}
#calendar_month .month_row .month_date .day_title:hover {
text-decoration: underline;
}
#calendar_month .month_row td.today {
border-bottom: solid 1px #fff;
border-top: solid 1px #fff;
}
#calendar_month .month_row .event {
margin: 0 -2px;
position: relative;
color: #000;
}
#calendar_month .month_row .month_date .event:hover {
text-decoration: none !important;
}
#calendar_month .month_row td.disable {
background-color: #f6f6f6;
color: #ccc;
border-left: solid 1px #ddd;
}
#calendar_month .event.single {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/* agenda view */
#calendar_agenda {
border-bottom: solid 1px #ddd;
}
#calendar_agenda .table {
margin-bottom: 0;
}
#calendar_agenda .event {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.event_time {
font-family: Tahoma, sans-serif;
}
/* day view */
#calendar_day .header {
margin-bottom: 10px;
}
#calendar_day .header th {
text-align: center;
}
#calendar_day td {
border: 0;
}
#calendar_day .event {
margin-bottom: 2px;
}
#calendar_day .all_day_event {
background: #eee;
border: solid 1px #ddd
}
#calendar_day .event_list .table {
border-top: solid 1px #ddd;
}
#calendar_day .event_list td {
padding: 0;
}
/* week view */
#calendar_week {
}
#calendar_week .cell_wrapper {
position: absolute;
width: 100%;
}
#calendar_week td {
padding: 0;
}
#calendar_week .table {
margin-bottom: 0;
}
#calendar_week .header {
margin-bottom: 12px;
border-top: 0;
table-layout: fixed;
}
#calendar_week .header th {
text-align: center;
font-size: 12px;
}
#calendar_week .header td {
border: solid 1px #ddd;
background-color: #eee;
}
#calendar_week .week_day {
padding: 0 2px;
border: solid 1px #ddd;
}
#calendar_week .header .week_day {
padding: 1px 2px 10px 2px;
}
#calendar_week .event_list .event {
position: absolute;
width: 100%;
margin-bottom: 2px;
}
#calendar_week .cell_map {
margin-bottom: 18px;
}
#calendar_week .cell_map td {
border-top: 0;
border-bottom: 0;
}
#calendar_week .cell_map tr:first-child td {
border-top: solid 1px #ddd;
}
#calendar_week .event_holder .inner {
margin: 0 8px 0 0;
}
/* calendars(category) */
.calendars_color_tag {
width: 20px;
height: 20px;
display: inline-block;
border-radius: 3px;
box-shadow: inset 0 -1px 0 rgba(0,0,0,0.2);
}
/* Event Controller */
.event_controller {
width: 300px;
}
.event_controller .row-fluid {
margin-bottom: 6px;
}
.event_controller .row-fluid .control-label {
line-height: 30px;
}
.close {
border: 0;
background: none;
}
/* miniColors tweak */
.miniColors-trigger {
width: 20px;
height: 20px;
margin-bottom: 10px;
margin-left: 10px;
border-color: #f1f1f1;
}
.miniColors-selector {
float: none;
margin: 4px 0 0 0;
}
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,77 @@
class Panel::Calendar::BackEnd::CalsController < OrbitBackendController
include AdminHelper
include Panel::Calendar::BackEnd::CalsHelper
def index
end
def new
@calendar = Cal.new
@calendars = Cal.all
end
def create
@calendar = Cal.new(params[:cal])
@calendar.save!
respond_to do |h|
h.js
end
end
def destroy
calendar = Cal.find(params[:id])
calendar.delete
render :json => {"success"=>"true"}.to_json
end
def day_view
render :layout => false
end
def week_view
render :layout => false
end
def month_view
month = params[:month].to_i
year = params[:year].to_i
t = Time.now
startday = monthStartDay(month,year)
@pre_disabled_days = startday - 1
if t.month == month && t.year == year
@today = @pre_disabled_days + t.day
else
@today = 50
end
cur_month_days = getMonthDays(year)
@post_disabled_days = @pre_disabled_days + cur_month_days[month]
@dateset = getDateSet(month,year)
render :layout => false
end
def agenda_view
render :layout => false
end
def get_events
month = params[:month]
year = params[:year]
events = Event.where(:start_month => month).and(:start_year => year)
@events = Array.new
events.each do |event|
# @temp = Array.new
no_of_days = Date.new(event.end_year,event.end_month,event.end_date) - Date.new(event.start_year,event.start_month,event.start_date)
no_of_days = no_of_days.to_i
no_of_days += 1
color = Cal.find(event.cal_id).color
@events << {"start_date"=>event.start_date, "total_days" => no_of_days, "title" => event.title,"color"=>color}
end
render :json => @events.to_json
end
end
@@ -0,0 +1,58 @@
class Panel::Calendar::BackEnd::EventsController < OrbitBackendController
def new
@calendars = Cal.all
@event = Event.new
if params[:ref] == "add-btn"
@all_day_disabled = true
else
@all_day_disabled = false
end
@placeholder = params[:date]+"/"+params[:month]+"/"+params[:year]
render :layout => false
end
def create
title = params[:event][:title]
note = params[:event][:note]
$start = params[:start_date]
$end = params[:end_date]
$starttime = params[:start_time]
$endtime = params[:end_time]
temp = $start.split("/")
start_date = temp[0]
start_month = temp[1]
star_year = temp[2]
temp = $end.split("/")
end_date = temp[0]
end_month = temp[1]
end_year = temp[2]
start_am_pm = params[:start_am_pm]
end_am_pm = params[:end_am_pm]
cal_id = params[:event][:cal_id]
@event = Event.new
@event.title = title
@event.note = note
@event.start_year = star_year
@event.end_year = end_year
@event.start_month = start_month
@event.end_month = end_month
@event.start_date = start_date
@event.end_date = end_date
@event.start_time = $starttime
@event.start_am_pm = start_am_pm
@event.end_time = $endtime
@event.end_am_pm = end_am_pm
@event.cal_id = cal_id
@event.save!
respond_to do |h|
h.js
end
end
end
Whitespace-only changes.
@@ -0,0 +1,65 @@
module Panel::Calendar::BackEnd::CalsHelper
def monthStartDay(month,year)
dt = Date.new(year,month,1)
startday = dt.wday + 1
return startday
end
def getDateSet(month,year)
dateset = Array.new
startday = monthStartDay(month,year)
monthsdays = getMonthDays(year)
cur_month_days = monthsdays[month]
next_month_days = monthsdays[month+1]
prev_month_days = monthsdays[month-1]
prev_month_days_to_add = startday - 1
i = prev_month_days_to_add
while i > 0 do
i -= 1
dateset << prev_month_days - i
end
i = 0
while i < cur_month_days do
dateset << i + 1
i += 1
end
next_month_days_to_add = 42 - (prev_month_days_to_add + cur_month_days)
i = 0
while i < next_month_days_to_add do
dateset << i + 1
i += 1
end
return dateset
end
def getMonthDays(year)
monthsdays = Array.new
monthsdays << 0
monthsdays << 31
if Date.new(year).leap?
monthsdays << 29
else
monthsdays << 28
end
monthsdays << 31
monthsdays << 30
monthsdays << 31
monthsdays << 30
monthsdays << 31
monthsdays << 31
monthsdays << 30
monthsdays << 31
monthsdays << 30
monthsdays << 31
return monthsdays
end
end
Whitespace-only changes.
Whitespace-only changes.
+9
View File
@@ -0,0 +1,9 @@
class Cal
include Mongoid::Document
include Mongoid::Timestamps
field :name, localize: true
field :color
has_many :events, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :events, :allow_destroy => true
end
+20
View File
@@ -0,0 +1,20 @@
class Event
include Mongoid::Document
include Mongoid::Timestamps
field :title
field :note
field :start_year, type: Integer
field :end_year, type: Integer
field :start_month, type: Integer
field :end_month, type: Integer
field :start_date, type: Integer
field :end_date, type: Integer
field :start_time, type: Float
field :start_am_pm
field :end_time, type: Float
field :end_am_pm
belongs_to :cal
end
Whitespace-only changes.
@@ -0,0 +1,16 @@
<tr class="with_action" for="<%= calendar.id.to_s %>">
<td>
<span class="calendars_color_tag" style="background-color: <%= calendar.color %>"></span>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><a href="">Edit</a></li>
<li><%= link_to t("calendar.delete"), panel_calendar_back_end_cal_path(calendar), :method => "delete",:remote => true, :confirm => t("gallery.sure?"),:class=>"btn-del-a", "data-content"=>calendar.id.to_s %></li>
</ul>
</div>
</td>
<% @site_valid_locales.each do |locale| %>
<td>
<%= calendar.name_translations[locale] %>
</td>
<% end %>
</tr>
@@ -0,0 +1,48 @@
<div id="calendar_agenda">
<table class="table">
<thead>
<tr>
<th class="span2"></th>
<th class="span2"></th>
<th class=""></th>
</tr>
</thead>
<tbody>
<tr>
<th class="today">Thu, Sep 6</th>
<td class="event_time">9:00am - 9:30am</td>
<td>
<div class="event" style="color: #ffcc00;">Commuting time, from home to RD</div>
</td>
</tr>
<tr>
<th></th>
<td class="event_time">9:30am - 12:00am</td>
<td>
<div class="event" style="color: #ffcc00;">Work on Thu project, and ask ika for help if possible</div>
</td>
</tr>
<tr>
<th></th>
<td class="event_time">13:30pm - 18:00pm</td>
<td>
<div class="event" style="color: #ffcc00;">Template design, at least finish 2 template</div>
</td>
</tr>
<tr>
<th>Fri, Sep 7</th>
<td class="event_time">9:00am - 18:00pm</td>
<td>
<div class="event" style="color: #ddee00;">Take a day off</div>
</td>
</tr>
<tr>
<th>Sat, Sep 8</th>
<td class="event_time">7:00am - 7:50pm</td>
<td>
<div class="event" style="color: #00ddee;">Work out with Joseph</div>
</td>
</tr>
</tbody>
</table>
</div>
@@ -0,0 +1 @@
$("#calendar_list").prepend("<%= j render :partial=>'calendar', :object=>@calendar %>");
@@ -0,0 +1,157 @@
<div id="calendar_day">
<table class="table header">
<tr>
<th class="span1"></th>
<th>
<h2>Sunday 9/2</h2>
</th>
</tr>
<tr>
<td></td>
<td class="all_day_event">
<div class="event" style="background-color: #ffcc00;">event1</div>
<div class="event" style="background-color: #ffcc00;">event2</div>
</td>
</tr>
</table>
<div class="event_list">
<table class="table">
<tr>
<td style="width: 60px;">
<div class="day_time">12am</div>
<div class="day_time">1am</div>
<div class="day_time">2am</div>
<div class="day_time">3am</div>
<div class="day_time">4am</div>
<div class="day_time">5am</div>
<div class="day_time">6am</div>
<div class="day_time">7am</div>
<div class="day_time">8am</div>
<div class="day_time">9am</div>
<div class="day_time">10am</div>
<div class="day_time">11am</div>
<div class="day_time">12am</div>
<div class="day_time">1pm</div>
<div class="day_time">2pm</div>
<div class="day_time">3pm</div>
<div class="day_time">4pm</div>
<div class="day_time">5pm</div>
<div class="day_time">6pm</div>
<div class="day_time">7pm</div>
<div class="day_time">8pm</div>
<div class="day_time">9pm</div>
<div class="day_time">10pm</div>
<div class="day_time">11pm</div>
</td>
<td style="position: relative;">
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="event_holder">
<div class="inner">
<div class="event" style="background-color: #66cc00; top: 0;">
<dl>
<dt>10:30am - 11:00am</dt>
<dd>template</dd>
</dl>
</div>
<div class="event" style="background-color: #00aacc; top: 39px;">
<dl>
<dt>10:30am - 11:00am</dt>
<dd>template</dd>
</dl>
</div>
<div class="event half" style="background-color: #ccffee; top: 117px;">
<dl>
<dt>10:30am - template</dt>
<dd></dd>
</dl>
</div>
<div class="event" style="background-color: #00ffee; top: 195px; width: 85%;">
<dl>
<dt>10:30am - 11:00am</dt>
<dd>template</dd>
</dl>
</div>
<div class="event over" style="background-color: #00ccee; top: 214px; left: 50%; width: 50%;">
<dl>
<dt>10:30am - 11:00am</dt>
<dd>template</dd>
</dl>
</div>
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
@@ -0,0 +1,73 @@
<%= stylesheet_link_tag "font-awesome" %>
<%= stylesheet_link_tag "calendar" %>
<%= stylesheet_link_tag "bootstrap-responsive" %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "calendarAPI" %>
<% end %>
<div id="filter" class="subnav">
<ul class="nav nav-pills filter">
<li class="accordion-group">
<div class="accordion-heading">
<a href="#collapse-categories" data-toggle="collapse" data-parent=".filters" class="accordion-toggle"><span class="" title="">Calendar</span> <b class="web-symbol"></b></a>
</div>
</li>
</ul>
<div class="filters">
<div class="accordion-body collapse" id="collapse-categories">
<div class="accordion-inner filter_btns cats" data-toggle="buttons-checkbox">
<a href="" class="btn" onclick="return false;"><span class="calendar_color_tag" style="background-color: #ffcc00;"></span>Calendar1</a>
<a href="" class="btn" onclick="return false;"><span class="calendar_color_tag" style="background-color: #ff6600;"></span>Calendar2</a>
<a href="" class="btn" onclick="return false;"><span class="calendar_color_tag" style="background-color: #ff4400;"></span>Calendar3</a>
</div>
<div class="filter-clear">
<a href="" class="btn" onclick="return false;" for="cats"><i class="icons-brush-large"></i>Clear</a>
</div>
</div>
</div>
</div>
<div id="orbit_calendar" class="month_view">
<div class="row-fluid">
<div class="span3">
<div class="btn-toolbar" style="margin:0;">
<div class="btn-group">
<button class="btn" id="today_btn">Today</button>
</div>
<div class="btn-group">
<button class="btn" id="prev_month_btn"><span class="icon-chevron-left"></span></button>
<button class="btn" id="next_month_btn"><span class="icon-chevron-right"></span></button>
</div>
</div>
</div>
<div class="span5">
<h4 class="current_day_title"></h4>
</div>
<div class="span4">
<div class="btn-group calendar_mode" data-toggle="buttons-radio">
<button class="btn mode_switch">day</button>
<button class="btn mode_switch">week</button>
<button class="btn active mode_switch">month</button>
<button class="btn mode_switch">agenda</button>
</div>
</div>
</div>
<div id="view_holder"></div>
</div>
<div class="form-actions form-fixed">
<div class="row-fluid">
<div class="span8">
</div>
<div class="span4">
<%= link_to "Add", new_panel_calendar_back_end_event_path, :class => "btn btn-primary pull-right", :id=>"create_event_btn", :ref=>"add-btn" %>
</div>
</div>
</div>
<div id="event_create" class="modal" style="right: 8px; bottom: 50px; left: auto; top: auto; width: 330px; margin: 0;display:none;"></div>
<div id="event_quick_view" class="modal" style="width: 300px; top: 60%;display:none"></div>
<script type="text/javascript">
var calendar = new calendarAPI();
</script>
@@ -0,0 +1,58 @@
<div id="calendar_month">
<div class="month_row header">
<table class="table">
<tr>
<th>Sun</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
</tr>
</table>
</div>
<% i = 0 %>
<% day_count_for_title = 0 %>
<% day_count_for_space = 0 %>
<% while i < 6 %>
<div class="month_row">
<table class="table month_table">
<tr>
<% x = 0 %>
<% while x < 7 %>
<% if day_count_for_space < @pre_disabled_days %>
<td class="disable"></td>
<% elsif day_count_for_space >= @post_disabled_days %>
<td class="disable"></td>
<% elsif day_count_for_space == @today-1 %>
<td class="today"></td>
<% else %>
<td></td>
<% end %>
<% day_count_for_space += 1 %>
<% x += 1 %>
<% end %>
</tr>
</table>
<table class="table month_date" row="<%= i+1 %>">
<tr>
<% x = 0 %>
<% while x < 7 %>
<% if day_count_for_title < @pre_disabled_days %>
<td class="day_title disable" no="<%= day_count_for_title+1 %>"><%= @dateset[day_count_for_title] %></td>
<% elsif day_count_for_title >= @post_disabled_days %>
<td class="day_title disable" no="<%= day_count_for_title+1 %>"><%= @dateset[day_count_for_title] %></td>
<% else %>
<td class="day_title click_event" ref="day-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @dateset[day_count_for_title] %>" position="<%= x+1 %>" no="<%= day_count_for_title+1 %>"><%= @dateset[day_count_for_title] %></td>
<% end %>
<% day_count_for_title += 1 %>
<% x += 1 %>
<% end %>
</tr>
</table>
</div>
<% i += 1 %>
<% end %>
</div>
@@ -0,0 +1,68 @@
<%= stylesheet_link_tag "jquery.miniColors" %>
<%= stylesheet_link_tag "calendar" %>
<%= javascript_include_tag "jquery.miniColors.min" %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "calendarAPI" %>
<% end %>
<div id="filter" class="subnav">
<div class="filters">
<div id="sort_headers" class="table-label">
<table class="table main-list">
<thead>
<tr>
<th class="span2"><span class="" title="">Color</span></th>
<th class="span2">English</th>
<th class="span2">Chinese</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<table id="calendars" class="table main-list">
<thead>
<tr>
<th class="span2"></th>
<th class="span2"></th>
<th class="span2"></th>
</tr>
</thead>
<tbody id="calendar_list">
<%= render :partial => "calendar", :collection => @calendars %>
</tbody>
</table>
<div id="form">
<%= form_for @calendar, :url => {:action => "create"}, :remote => true do |f| %>
<h2>Add</h2>
<div class="row-fluid">
<div class="span2">
<%= label_tag("color", t("calendar.color")) %>
<%= f.text_field :color, :class => "color-picker miniColors span5", :size => "7", :maxlength => "7", :autocomplete=>"off",:value=>"9100FF" %>
</div>
</div>
<div>
<%= f.fields_for :name_translations do |name| %>
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="control-group">
<%= label_tag(locale, t("calendar.name")+"-"+I18nVariable.from_locale(locale)) %>
<div class="controls">
<%= name.text_field locale, :class => "input-xxlarge", :size=>"30" %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="form-actions pagination-right">
<%= f.submit t("calendar.save"), :class=>"btn btn-primary" %>
</div>
<% end %>
</div>
<script type="text/javascript">
var calendar = new calendarAPI()
calendar.newCalendars();
</script>
@@ -0,0 +1,198 @@
<div id="calendar_week">
<table class="table header">
<tr>
<th style="width: 44px;"></th>
<th>Sun 9/11</th>
<th>Mon 9/12</th>
<th class="today">Tue 9/13</th>
<th>Wed 9/14</th>
<th>Thu 9/15</th>
<th>Fri 9/16</th>
<th>Sat 9/17</th>
</tr>
<tr>
<td style="border: 0; background: none;"></td>
<td class="all_day_event week_day">
<div class="event half" style="background-color: #ccffee;">
<dl>
<dt>10:30am - template</dt>
<dd></dd>
</dl>
</div>
</td>
<td class="all_day_event week_day">
</td>
<td class="all_day_event week_day"></td>
<td class="all_day_event week_day">
<div class="event half" style="background-color: #ccffee;">
<dl>
<dt>10:30am - template</dt>
<dd></dd>
</dl>
</div>
</td>
<td class="all_day_event week_day"></td>
<td class="all_day_event week_day"></td>
<td class="all_day_event week_day"></td>
</tr>
</table>
<div class="event_list">
<table class="table cell_map">
<tr height="1">
<td style="width: 60px;"></td>
<td colspan="7" style="position: relative;">
<div class="cell_wrapper">
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
<div class="cell">
<div class="divide"></div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="day_time">12am</div>
<div class="day_time">1am</div>
<div class="day_time">2am</div>
<div class="day_time">3am</div>
<div class="day_time">4am</div>
<div class="day_time">5am</div>
<div class="day_time">6am</div>
<div class="day_time">7am</div>
<div class="day_time">8am</div>
<div class="day_time">9am</div>
<div class="day_time">10am</div>
<div class="day_time">11am</div>
<div class="day_time">12am</div>
<div class="day_time">1pm</div>
<div class="day_time">2pm</div>
<div class="day_time">3pm</div>
<div class="day_time">4pm</div>
<div class="day_time">5pm</div>
<div class="day_time">6pm</div>
<div class="day_time">7pm</div>
<div class="day_time">8pm</div>
<div class="day_time">9pm</div>
<div class="day_time">10pm</div>
<div class="day_time">11pm</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day today">
<div class="event_holder">
<div class="inner">
<div class="event" style="background-color: #ccffee; top: 117px;">
<dl>
<dt>10:30am - 11:00am</dt>
<dd>template</dd>
</dl>
</div>
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
<td class="week_day">
<div class="event_holder">
<div class="inner">
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
@@ -0,0 +1,2 @@
$("#event_create").empty().hide();
$("#create_event_btn").removeClass("active");
@@ -0,0 +1,116 @@
<div class="modal-body">
<div class="event_controller">
<!-- <form class="form-horizontal"> -->
<%= form_for @event, :url =>{:action => :create}, :class=>"form-horizontal", :remote => true do |f| %>
<div class="row-fluid">
<button type="button" class="close btn-close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="row-fluid">
<%= f.text_field :title, :class=>"span12", :placeholder => "Event Name" %>
</div>
<div class="row-fluid">
<% if !@all_day_disabled %>
<label class="checkbox inline">
<input type="checkbox" for="all_day"> All day
</label>
<% end %>
<label class="checkbox inline">
<input type="checkbox"> Repeat
</label>
</div>
<div id="non_all_day">
<div class="row-fluid">
<label class="control-label span3">From</label>
<div class="row-fluid span9">
<input class="span5" type="text" value="<%= @placeholder %>" name="start_date" placeholder="<%= @placeholder %>">
<select name="start_time" class="span4">
<option value="1.00">1:00</option>
<option value="1.30">1:30</option>
<option value="2.00">2:00</option>
<option value="2.30">2:30</option>
<option value="3.00">3:00</option>
<option value="3.30">3:30</option>
<option value="4.00">4:00</option>
<option value="4.30">4:30</option>
<option value="5.00">5:00</option>
<option value="5.30">5:30</option>
<option value="6.00">6:00</option>
<option value="6.30">6:30</option>
<option value="7.00">7:00</option>
<option value="7.30">7:30</option>
<option value="8.00">8:00</option>
<option value="8.30">8:30</option>
<option value="9.00">9:00</option>
<option value="9.30">9:30</option>
<option value="10.00">10:00</option>
<option value="10.30">10:30</option>
<option value="11.00">11:00</option>
<option value="11.30">11:30</option>
<option value="12.00">12:00</option>
<option value="12.30">12:30</option>
</select>
<select name="start_am_pm" class="span3">
<option value="AM">AM</option>
<option value="PM">PM</option>
</select>
</div>
</div>
<div class="row-fluid">
<label class="control-label span3">To</label>
<div class="row-fluid span9">
<input class="span5" type="text" name="end_date" value="<%= @placeholder %>" placeholder="<%= @placeholder %>">
<select name="end_time" class="span4">
<option value="1.00">1:00</option>
<option value="1.30">1:30</option>
<option value="2.00">2:00</option>
<option value="2.30">2:30</option>
<option value="3.00">3:00</option>
<option value="3.30">3:30</option>
<option value="4.00">4:00</option>
<option value="4.30">4:30</option>
<option value="5.00">5:00</option>
<option value="5.30">5:30</option>
<option value="6.00">6:00</option>
<option value="6.30">6:30</option>
<option value="7.00">7:00</option>
<option value="7.30">7:30</option>
<option value="8.00">8:00</option>
<option value="8.30">8:30</option>
<option value="9.00">9:00</option>
<option value="9.30">9:30</option>
<option value="10.00">10:00</option>
<option value="10.30">10:30</option>
<option value="11.00">11:00</option>
<option value="11.30">11:30</option>
<option value="12.00">12:00</option>
<option value="12.30">12:30</option>
</select>
<select name="end_am_pm" class="span3">
<option value="AM">AM</option>
<option value="PM">PM</option>
</select>
</div>
</div>
</div>
<div class="row-fluid">
<label for="" class="control-label span3">Calendars</label>
<div class="row-fluid span9">
<%= f.select(:cal_id, Cal.all.collect {|p| [ p.name, p.id ] },{:prompt => t("calendar.select_calendar")},:class => "validate") %>
</div>
</div>
<div class="row-fluid">
<label for="" class="control-label span3">Note</label>
<div class="row-fluid span9">
<%= f.text_area :note, :class=>"span12", :cols=>"30", :rows=>"3" %>
</div>
</div>
<div class="row-fluid">
<div class="span9 offset3">
<button class="btn btn-close">Cancel</button>
<%= f.submit t("calendar.create"), :class=>"btn" %>
</div>
</div>
<% end %>
<!-- </form> -->
</div>
</div>
@@ -0,0 +1,13 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Event Name</h3>
</div>
<div class="modal-body">
<div class="event_summary">
Thu, September 13
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn">Delete</a>
<a href="#" class="btn btn-primary">Edit</a>
</div>
+23
View File
@@ -0,0 +1,23 @@
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "calendar/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "calendar"
s.version = Calendar::VERSION
s.authors = ["TODO: Your name"]
s.email = ["TODO: Your email"]
s.homepage = "TODO"
s.summary = "TODO: Summary of Calendar."
s.description = "TODO: Description of Calendar."
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
s.add_dependency "rails", "~> 3.1.4"
# s.add_dependency "jquery-rails"
s.add_development_dependency "sqlite3"
end
@@ -0,0 +1,9 @@
en:
calendar:
calendars: Calendars
color: Color
name: Name
save: Save
delete: Delete
select_calendar: "Select Calendar"
create: Create
@@ -0,0 +1,3 @@
zh_tw:
calendar:
calendars: Calendars
+18
View File
@@ -0,0 +1,18 @@
Rails.application.routes.draw do
namespace :panel do
namespace :calendar do
namespace :back_end do
match 'cals/agenda_view' => 'cals#agenda_view', :via => :get
match 'cals/month_view' => 'cals#month_view', :via => :get
match 'cals/day_view' => 'cals#day_view', :via => :get
match 'cals/week_view' => 'cals#week_view', :via => :get
match 'cals/getEvents' => 'cals#get_events', :via => :get
resources :cals
resources :events
end
end
end
end
+4
View File
@@ -0,0 +1,4 @@
require "calendar/engine"
module Calendar
end
@@ -0,0 +1,4 @@
module Calendar
class Engine < Rails::Engine
end
end
@@ -0,0 +1,3 @@
module Calendar
VERSION = "0.0.1"
end
@@ -0,0 +1,4 @@
# desc "Explaining what the task does"
# task :calendar do
# # Task goes here
# end
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env ruby
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
ENGINE_PATH = File.expand_path('../..', __FILE__)
load File.expand_path('../../test/dummy/script/rails', __FILE__)
@@ -0,0 +1,7 @@
require 'test_helper'
class CalendarTest < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, Calendar
end
end
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Dummy::Application.load_tasks
@@ -0,0 +1,9 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
@@ -0,0 +1,7 @@
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require_tree .
*/
@@ -0,0 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end
@@ -0,0 +1,2 @@
module ApplicationHelper
end
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Dummy</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
+4
View File
@@ -0,0 +1,4 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Dummy::Application
@@ -0,0 +1,45 @@
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require
require "calendar"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
end
end
@@ -0,0 +1,10 @@
require 'rubygems'
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
if File.exist?(gemfile)
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
end
$:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
@@ -0,0 +1,5 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Dummy::Application.initialize!
@@ -0,0 +1,30 @@
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
end
@@ -0,0 +1,60 @@
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
# Defaults to Rails.root.join("public/assets")
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end
@@ -0,0 +1,39 @@
Dummy::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
end
@@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
@@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Dummy::Application.config.secret_token = '51389313d40e5a40269583258f5a6734ca9764cd65e633594119a8cb165b4058f032d11407e10634acd50965e156a9c7f894b9e617526afe373506699bf6c2ee'
@@ -0,0 +1,8 @@
# Be sure to restart your server when you modify this file.
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end
# Disable root element in JSON by default.
ActiveSupport.on_load(:active_record) do
self.include_root_in_json = false
end
@@ -0,0 +1,5 @@
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
hello: "Hello world"
@@ -0,0 +1,58 @@
Dummy::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
</body>
</html>
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>The change you wanted was rejected (422)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/422.html -->
<div class="dialog">
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
</body>
</html>
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<h1>We're sorry, but something went wrong.</h1>
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
</div>
</body>
</html>
Whitespace-only changes.
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
@@ -0,0 +1,10 @@
require 'test_helper'
class NavigationTest < ActionDispatch::IntegrationTest
fixtures :all
# test "the truth" do
# assert true
# end
end
+10
View File
@@ -0,0 +1,10 @@
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require "rails/test_help"
Rails.backtrace_cleaner.remove_silencers!
# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 431 B

@@ -10,45 +10,16 @@ var galleryAPI = function(){
this.albumArea = $("#orbit_gallery");
this.loadArea = null;
this.tagList = $("ul#gallery_tag_list");
// this.authenticated = false;
this.initialize = function(callbackFn){
$(document).ready(function(){
bindHandlers();
var passid = null;
if(typeof g.urlVars['cat']!= "undefined"){
g.loadArea = "albums";
passid = g.urlVars['cat'];
g.loadAlbums(g.urlVars['cat']);
}else if(typeof g.urlVars['album']!= "undefined"){
g.loadArea = "images";
passid = g.urlVars['album'];
g.loadImages(g.urlVars['album']);
}else if(typeof g.urlVars['theater']!= "undefined"){
g.loadArea = "theater";
passid = g.urlVars['theater'];
g.loadTheater(g.urlVars['theater']);
}else if(typeof g.urlVars['edit']!= "undefined"){
g.loadArea = "edit";
passid = g.urlVars['edit'];
g.editAlbum(g.urlVars['edit']);
}else if(typeof g.urlVars['tag']!= "undefined"){
g.loadArea = "albums";
passid = g.urlVars['tag'];
g.loadAlbums(g.urlVars['tag']);
}else if(g.urlVars.length == 0){
g.loadArea = "albums";
g.loadAlbums("all");
}
if(typeof callbackFn == "function"){
callbackFn.call(this,g.loadArea,passid);
}
})
var bindHandlers = function(){
$("#filter .filter_btns a").click(function(){
if(!$(this).hasClass("active")){
$(this).addClass("active");
if(g.urlVars.length == 0)
window.location = "orbit_gallery?" + $(this).attr("href");
window.location = "albums?" + $(this).attr("href");
else
window.location = window.location.href +"&"+ $(this).attr("href");
}else{
@@ -63,47 +34,39 @@ var galleryAPI = function(){
window.location = url;
}
})
}
$("#filter .filter-clear a").click(function(){
var loc = window.location.href;
var url = null;
var forwhat = $(this).attr("for");
$("#filter ."+forwhat+" a.active").each(function(){
$(this).removeClass("active");
url = loc.replace($(this).attr("href")+"&","");
if(url == loc)
url = loc.replace($(this).attr("href"),"");
$("#filter .filter-clear a").click(function(){
var loc = window.location.href;
var url = null;
var forwhat = $(this).attr("for");
$("#filter ."+forwhat+" a.active").each(function(){
$(this).removeClass("active");
url = loc.replace($(this).attr("href")+"&","");
if(url == loc)
url = loc.replace($(this).attr("href"),"");
if(url.charAt(url.length-1)=="&" || url.charAt(url.length-1)=="?")
url = url.substr(0,url.length-1);
loc = url;
if(url.charAt(url.length-1)=="&" || url.charAt(url.length-1)=="?")
url = url.substr(0,url.length-1);
loc = url;
})
window.location = url;
})
window.location = url;
})
}
}
this.makeNewAlbum = function(){
$.get("add_album",function(html){
rcom.modalWindow({loadHtml:html,width:400,"closeBtn":false},function(dom){
dom.find("#album_name_save_btn").click(function(){
var options ={
cid : dom.find("select#category_list").val(),
albumname : {
"en" : dom.find("#name_en").val(),
"zh_tw" : dom.find("#name_zh_tw").val()
},
albumdesc : {
"en" : dom.find("#desc_en").val(),
"zh_tw" : dom.find("#desc_zh_tw").val()
this.makeNewAlbum = function(path){
$.get(path,function(html){
rcom.modalWindow({loadHtml:html,width:400,height:320,"closeBtn":false},function(dom){
$("form#new_gallery_album").submit(function(){
var validated = true;
$(this).find(".error").removeClass("error");
$(this).find(".validate").each(function(){
if(!$(this).val()){
validated = false;
$(this).parent().addClass("error");
}
}
if(options.cid){
$.post("create_album",options,function(response){
if(g.loadArea == "albums")
g.loadAlbums("all");
rcom.modalWindowClose();
})
}
})
if(!validated)
return false;
})
dom.find("#album_name_close_btn").click(function(){
rcom.modalWindowClose();
@@ -114,27 +77,25 @@ var galleryAPI = function(){
}
this.deleteAlbum = function(id){
if(confirm("<%= I18n.t('gallery.del_album?') %>")){
$.post("delete_album",{aid:id},function(){
window.location = "orbit_gallery";
$.ajax({
type: "DELETE",
url : id,
success : function(){
window.location = "../albums";
}
})
}
}
this.loadAlbums = function(id){
g.loadFooterPanel(g.loadArea,id,function(headbtn){
headbtn = $(headbtn);
headbtn.click(function(){g.makeNewAlbum();})
g.albumArea.find(".rghead .rgfn").html(headbtn);
})
g.albumArea.find(".rghead .rgfn a").click(function(){g.makeNewAlbum($(this).attr("href"))});
g.albumArea.addClass('o_gallery');
g.albumArea.find("#imgholder").empty();
// var $addsign = $('<div class="rgalbum"><a id="global_add" class="rgui bt-addnew" href="add" onclick="return false;">Add Album</a></div>');
// $addsign.find("a").click(function(){g.makeNewAlbum();})
if(id!="all"){
var cids = [];
var tids = [];
var href = null;
console.log(cids);
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++){
hash = hashes[i].split('=');
@@ -155,71 +116,68 @@ var galleryAPI = function(){
$.getJSON("get_albums",{cid:cids,tid:tids},function(categories){
$.each(categories,function(x,category){
$.each(category,function(i,album){
album.description = (album.description?album.description:"<%= I18n.t('gallery.no_description') %>")
if(album.cover == "default")
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='?album="+album._id+"'><img src='../../../assets/gallery/default.jpg' width='120px' height='90px'/></a><span class='albumname'>"+album.name+"</span><br /><span class='tagnames'></span></div>");
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><img src='../../../assets/gallery/default.jpg' /></a><span class='albumname'>"+album.name+"</span><span class='categoryname'>"+album.category_name+"</span><span class='tagnames'></span></div>");
else
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='?album="+album._id+"'><img src='"+album.cover_path+"' width='120px' height='90px'/></a><span class='albumname'>"+album.name+"</span><br /><span class='tagnames'></span></div>");
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><img src='"+album.cover_path+"' /></a><span class='albumname'>"+album.name+"</span><span class='categoryname'>"+album.category_name+"</span><span class='tagnames'></span></div>");
var tag_string = "";
for(tag in album.tag_names){
tag_string+=album.tag_names[tag] + " ";
tag_string+= '<span class="label label-tags">' + album.tag_names[tag] + '</span>';
}
$img.find("span.tagnames").text(tag_string);
$img.find(".tagnames").html(tag_string);
g.albumArea.find("#imgholder").append($img);
})
})
// g.albumArea.find("#imgholder").append($addsign);
})
}
this.loadImages = function(id){
var panelopen = false;
g.loadFooterPanel(g.loadArea,id,function(headerPanel){
headarea = $(headerPanel);
g.albumArea.find(".rghead .rgfn").html(headarea);
$('.bt-tag').click(function(){
$(this).toggleClass("active");
var $tag_panel = $('#tag_panel'),
tag_panel_position = 0;
$('.bt-tag').click(function(){
$(this).toggleClass("active");
var $tag_panel = $('#tag_panel'),
tag_panel_position = 0;
if( $tag_panel.css('right') == '0px' ){
tag_panel_position = -200;
}
$tag_panel.animate({'right':tag_panel_position}, 300);
if( $tag_panel.css('right') == '0px' ){
tag_panel_position = -200;
}
$tag_panel.animate({'right':tag_panel_position}, 300);
g.albumArea
.delay(200)
.animate({'margin-right':tag_panel_position+200},300);
return false;
});
g.albumArea.find("#tag_search_box").keyup(function(e){
sval = $(this).val();
if(sval == "<%= I18n.t('gallery.search_tags') %>")
sval = "";
sval = sval.replace(/(^\s*)|(\s*$)/g,'');
if(sval){
var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range
var re2 = new RegExp("^[\uE7C7-\uE7F3]*$");
if ((re1.test(sval) && (re2.test(sval)))){
$("ul#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
}else{
$("ul#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
}
g.albumArea
.delay(200)
.animate({'margin-right':tag_panel_position+200},300);
return false;
});
g.albumArea.find("#tag_search_box").keyup(function(e){
sval = $(this).val();
if(sval == "<%= I18n.t('gallery.search_tags') %>")
sval = "";
sval = sval.replace(/(^\s*)|(\s*$)/g,'');
if(sval){
var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range
var re2 = new RegExp("^[\uE7C7-\uE7F3]*$");
if ((re1.test(sval) && (re2.test(sval)))){
$("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
}else{
$("ul#gallery_tag_list li").slideDown();
$("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
}
})
g.albumArea.find("#tag_panel button.bt-save").click(function(){
g.saveTags(id,g.loadArea);
})
g.albumArea.find(".rghead .rgfn a.bt-add").click(function(){
showUploadPanel();
})
g.albumArea.find(".rghead .rgfn a.bt-del").click(function(){
g.deleteAlbum(id);
})
}else{
$("#gallery_tag_list li").slideDown();
}
})
g.albumArea.find("#tag_panel .bt-save").click(function(){
g.saveTags(id,"album");
})
g.albumArea.find(".rghead .rgfn .bt-add").click(function(){
showUploadPanel();
})
g.albumArea.find(".rghead .rgfn .bt-del").click(function(){
g.deleteAlbum(id);
})
$("#upload_panel_holder").remove();
var uploadpanel = $('<div id="upload_panel_holder"><div class="rgfn"><a class="bt-cls btn btn-primary pull-right" title="Close" href="" onclick="return false;"><i class="icon-remove icon-white"></i>Close Panel</a></div></div>');
var frame = $('<iframe id="upload_panel" width="100%" scrolling="no" height="200" frameborder="0" src="upload_panel"></iframe>');
uploadpanel.find("a.bt-cls").click(function(){
var frame = $('<iframe id="upload_panel" width="100%" scrolling="no" height="294" frameborder="0" src="'+id+'/upload_panel"></iframe>');
uploadpanel.find(".bt-cls").click(function(){
uploadpanel.hide("slide");
frame.remove();
g.loadImages(id);
@@ -233,28 +191,29 @@ var galleryAPI = function(){
}
}
g.albumArea.addClass('o_album');
g.albumArea.find(".rghead .rgfn").append(uploadpanel);
g.albumArea.find("#imgholder").empty();
$("#filter").remove();
g.albumArea.css("margin-top","");
// var $addsign = $('<div class="rgalbum"><a id="global_add" class="rgui bt-addnew" href="add" onclick="return false;">Add Album</a></div>');
// $addsign.find("a").click(function(){showUploadPanel();})
$.getJSON("get_images",{aid:id},function(album){
$.getJSON(id+"/imgs",function(album){
$.each(album.images,function(i,image){
var thumb = image.file.thumb.url;
var $img = $("<div class='rgalbum'><a title='"+image.description+"' href='?theater="+image._id+"'><img src='"+thumb+"'/></a></div>");
image.description = (image.description?image.description:"<%= I18n.t('gallery.no_description') %>")
var $img = $("<div class='rgphoto'><a title='"+image.description+"' href='"+image.theater_link+"'><img src='"+thumb+"'/></a></div>");
g.albumArea.find("#imgholder").append($img);
})
g.tagList.find("input").attr("checked",false);
$.each(album.tags,function(i,tag){
g.tagList.find("li[data-content="+tag+"] input").attr("checked",true);
})
// g.albumArea.find("#imgholder").append($addsign);
if(typeof album.tag_names == "undefined"){
$.each(album.tags,function(i,tag){
g.tagList.find("li[data-content="+tag+"] input").attr("checked",true);
})
}else{
$.each(album.tag_names,function(i,tagname){
$li = $("<li><label>"+tagname+"</label><span style='display:none;'>"+tagname+"</span></li>");
g.tagList.append($li);
})
}
})
// g.albumArea.find("#imgholder").append($addsign);
// tag
}
this.loadTheater = function(id){
var imageArray;
@@ -289,9 +248,23 @@ var galleryAPI = function(){
});
var updatePhotoTag = function(){
var tags = imageArray[imagecount].tag_ids;
g.tagList.find("input").attr("checked",false);
for(tag in tags){
g.tagList.find("li[data-content="+tags[tag]+"] input").attr("checked",true);
if(tags.length > 0 && g.tagList.find("li").length == 0){
var tagnames = imageArray[imagecount].tag_names;
g.tagList.empty();
for(i in tagnames){
$li = $("<li><label>"+tagnames[i]+"</label><span style='display:none;'>"+tagnames[i]+"</span></li>");
g.tagList.append($li);
}
}else if(tags.length > 0 && g.tagList.find("li").length > 0) {
g.tagList.find("input").attr("checked",false);
for(tag in tags){
g.tagList.find("li[data-content="+tags[tag]+"] input").attr("checked",true);
}
}else if(tags.length == 0){
if(g.tagList.find("input").length == 0)
g.tagList.empty();
else
g.tagList.find("input").attr("checked",false);
}
}
g.albumArea.find("#tag_search_box").keyup(function(e){
@@ -303,17 +276,19 @@ var galleryAPI = function(){
var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range
var re2 = new RegExp("^[\uE7C7-\uE7F3]*$");
if ((re1.test(sval) && (re2.test(sval)))){
$("ul#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
$("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
}else{
$("ul#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
$("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
}
}else{
$("ul#gallery_tag_list li").slideDown();
$("#gallery_tag_list li").slideDown();
}
})
g.albumArea.find("#tag_panel button.bt-save").click(function(){
g.saveTags(imageArray[imagecount]._id,g.loadArea);
g.albumArea.find("#tag_panel .bt-save").click(function(){
g.saveTags(imageArray[imagecount]._id,"pic",function(tagids){
imageArray[imagecount].tag_ids = tagids;
})
})
$(".slidectrl a.togglelist").click(function(){
var rslide_h = $rslide.outerHeight();
@@ -325,37 +300,38 @@ var galleryAPI = function(){
$slidelist.find("ul").hide();
}
})
$(".slidectrl a.togglescreen").click(function(){
$(".slidectrl .togglescreen").click(function(){
toggleFullscreen();
})
$(".slidectrl a.browserfullscreen").click(function(){
$(".slidectrl .browserfullscreen").click(function(){
browserFullScreen();
})
$slidelist.find("a.list_element").click(function(){
$slidelist.find(".list_element").click(function(){
imagecount = parseInt($(this).parent().attr("for"));
changeImage($(this));
})
$rslidenav.find("a.navN").click(function(){
$rslidenav.find(".navN").click(function(){
nextpic($(this));
})
$rslidenav.find("a.navP").click(function(){
prevpic($(this));
})
$("a#nextpic").click(function(){
$("#nextpic").click(function(){
nextpic($(this));
})
$(document).keydown(function(e){
if (e.keyCode == 37){
prevpic($rslidenav.find("a.navP"));
prevpic($rslidenav.find(".navP"));
return false;
}
if(e.keyCode == 39){
nextpic($rslidenav.find("a.navN"));
nextpic($rslidenav.find(".navN"));
return false;
}
if(e.keyCode == 27){
toggleFullscreen();
$rslide.removeClass('browserFullScreen');
return false;
}
if(e.keyCode == 70 || e.keyCode == 102){
@@ -368,6 +344,13 @@ var galleryAPI = function(){
rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen;
rfs.call(el);
}
$(window).resize(function(){
if(window.innerWidth == screen.width && window.innerHeight == screen.height) {
$rslide.addClass('browserFullScreen');
} else {
$rslide.removeClass('browserFullScreen');
}
})
var nextpic = function(dom){
if(imagecount == imageArray.length - 1)
imagecount = 0;
@@ -386,7 +369,7 @@ var galleryAPI = function(){
if($rslide.hasClass("fullscreen")){
$rslide.css("position","relative");
$rslide.removeClass("fullscreen");
$(".slidectrl a.browserfullscreen").hide();
$(".slidectrl .browserfullscreen").hide();
$img.css({"padding":""})
$("#main_pic").height(picHeight );
}else{
@@ -395,11 +378,12 @@ var galleryAPI = function(){
$rslide.css("position","");
$rslide.addClass("fullscreen");
$img.css({"padding":($rslide.height()-$img.height())/2})
$(".slidectrl a.browserfullscreen").show();
$(".slidectrl .browserfullscreen").show();
}
}
var changeImage = function(dom){
var pageurl = dom.attr('href');
$img.fadeOut(200,function(){
$img.attr({"src":dom.attr("data-content"),"height":picHeight+"px"});
$img.fadeIn(200);
@@ -408,13 +392,17 @@ var galleryAPI = function(){
}
$slidelist.stop().animate({'height':'0px'}, 300);
$slidelist.find("ul").hide();
if(pageurl!=window.location){
window.history.pushState({path:pageurl},'',pageurl);
}
if(rcom.getInternetExplorerVersion() == -1){
if(pageurl!=window.location){
window.history.pushState({path:pageurl},'',pageurl);
}
}else{
window.location.hash = pageurl;
}
// $(".slideinfo b.info").text(imageArray[imagecount].title);
if($('.bt-tag').hasClass("active"))
updatePhotoTag();
$(".slideinfo span.info").text(imageArray[imagecount].description);
$(".slideinfo .info").text(imageArray[imagecount].description);
if(imageArray.length > 1)
updateNavigation();
})
@@ -432,15 +420,15 @@ var galleryAPI = function(){
next = imagecount + 1;
prev = imagecount - 1;
}
$("a.navN").attr({"href":"orbit_gallery?theater="+imageArray[next]._id,"data-content":imageArray[next].file.url});
$("a.navP").attr({"href":"orbit_gallery?theater="+imageArray[prev]._id,"data-content":imageArray[prev].file.url});
$(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.url});
$(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.url});
};
if(imageArray.length > 1)
updateNavigation();
}
var preparestage = function(albumid){
$.getJSON("get_images",{aid:albumid},function(album){
$.getJSON("../albums/"+albumid+"/imgs",function(album){
imageArray = eval(album.images);
$.each(album.images,function(i,image){
if(image._id == id)
@@ -449,74 +437,106 @@ var galleryAPI = function(){
bindHandlers();
})
}
g.albumArea.find("#imgholder").load("theater?pic="+id,function(theater,response,xhr){
if(xhr.status == 404){
$(this).text("<%= I18n.t('gallery.pic_not_found') %>.");
return false;
}
$("#filter").remove();
g.albumArea.css("margin-top","");
var albumid = $(theater).find("#main_pic").attr("data-content");
g.loadFooterPanel(g.loadArea,id,function(head){
head = $(head);
g.albumArea.find(".rghead .rgfn").html(head);
g.albumArea.find("a.bt-back").attr("href","orbit_gallery?album="+albumid);
g.albumArea.find("a.bt-edit").attr("href","orbit_gallery?edit="+albumid);
})
g.albumArea.css("margin-bottom","0");
picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight());
preparestage(albumid);
});
if(rcom.getInternetExplorerVersion()!=-1){
var url_constructor = window.location.href.split("/");
var url = "";
for(x=0;x<=url_constructor.length-1;x++){
if(x == url_constructor.length-1){
url+="#!/"+url_constructor[x];
}else{
url+=url_constructor[x]+"/";
}
}
window.location.href = url;
}
var albumid = $("#main_pic").attr("data-content");
g.albumArea.find(".bt-back").attr("href","../albums/"+albumid);
g.albumArea.find(".bt-edit").attr("href","../albums/"+albumid+"/edit");
g.albumArea.css("margin-bottom","0");
picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight());
preparestage(albumid);
}
this.editAlbum = function(id){
var bindHandlers = function(){
$(".nav .nav-tabs a").click(function(){
$(".tab_content .tab-pane").hide();
})
$(".description_loader .edit_fn .bt-cover").click(function(){
$(".bt-cover").removeClass("setcover");
$(this).addClass("setcover");
$.post("set_cover",{"imageid":$(this).attr("href"),"aid":id},function(){})
$(".bt-cover").removeClass("setcover active btn-primary");
$(".bt-cover span").removeClass("icon-white icon-star").addClass("icon-star-empty");
$(this).addClass("setcover active btn-primary");
$(this).find("span").removeClass("icon-star-empty").addClass("icon-white icon-star");
$.post("set_cover",{"imageid":$(this).attr("for")});
})
$(".description_loader .edit_fn .bt-dels").click(function(){
$(this).toggleClass("setdelete");
if($(".description_loader .edit_fn .setdelete").length > 0){
g.albumArea.find(".rghead .rgfn .bt-delete").show();
}else{
g.albumArea.find(".rghead .rgfn .bt-delete").hide();
}
})
g.albumArea.find(".rghead .rgfn .bt-save").click(function(){
// var dataArray = Array();
// $(".description_loader .txtchange").each(function(){
// dataArray.push({"id":$(this).attr("for"),"text": $(this).val()});
// })
// var albumnm = Array();
// $(".albumname_edit .txtchange").each(function(){
// albumnm.push($(this).val())
// })
var dataArray = $("form#edit_album").serialize();
$.post("update_album",{"aid":id,"data":dataArray},function(){
$(this)
.toggleClass("setdelete btn-danger active")
.find('span').toggleClass('icon-white');
if($(".description_loader .edit_fn .setdelete").length > 0)
g.albumArea.find(".rghead .rgfn .bt-save").show();
})
if($(this).hasClass("active")){
$(this).parent().parent().find("input.del_field").val(true);
}else{
$(this).parent().parent().find("input.del_field").val(false);
}
delete_cover();
})
var delete_cover = function(){
if($(".description_loader .setcover").parent().find(".bt-dels").hasClass("active")){
$("input.del_cover").val(true);
}else{
$("input.del_cover").val(false);
}
}
var current_element_for_tags = null;
var current_element_no = null;
$('.bt-tag').click(function(){
var has_class = false;
if($(this).hasClass("active"))
has_class = true;
$('.bt-tag').removeClass("active");
$(this).toggleClass("active");
var count = 0;
$('.bt-tag').each(function(){
if($(this).hasClass("active"))
count++;
})
if(has_class){
$(this).removeClass("active");
count = 0;
}
var $tag_panel = $('#tag_panel'),
tag_panel_position = 0;
if( $tag_panel.css('right') == '0px' ){
tag_panel_position = -200;
}
if(count == 1)
tag_panel_position = 0
else if(count == 0){
if( $tag_panel.css('right') == '0px' ){
tag_panel_position = -200;
}
}
$tag_panel.animate({'right':tag_panel_position}, 300);
g.albumArea
.delay(200)
.animate({'margin-right':tag_panel_position+200},300);
current_element_for_tags = $(this).attr("href");
if(count == 1){
current_element_no = $(this).parent().attr("no");
if(imageTagArray[current_element_no].id == current_element_for_tags){
g.tagList.find("input").attr("checked",false);
for(tag in imageTagArray[current_element_no].tags){
g.tagList.find("li[data-content="+imageTagArray[current_element_no].tags[tag]+"] input").attr("checked",true);
}
}
}
return false;
});
g.albumArea.find("#tag_search_box").keyup(function(e){
@@ -528,17 +548,18 @@ var galleryAPI = function(){
var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range
var re2 = new RegExp("^[\uE7C7-\uE7F3]*$");
if ((re1.test(sval) && (re2.test(sval)))){
$("ul#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
$("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
}else{
$("ul#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
$("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
}
}else{
$("ul#gallery_tag_list li").slideDown();
$("#gallery_tag_list li").slideDown();
}
})
g.albumArea.find("#tag_panel button.bt-save").click(function(){
g.saveTags(imageArray[imagecount]._id,g.loadArea);
g.albumArea.find("#tag_panel .bt-save").click(function(){
g.saveTags(current_element_for_tags,"pic",function(tagids){
imageTagArray[current_element_no].tags = tagids;
})
})
var tempval;
$(".txtchange").focus(function(){
@@ -547,58 +568,23 @@ var galleryAPI = function(){
if($(this).val() != tempval)
g.albumArea.find(".rghead .rgfn .bt-save").show();
})
g.albumArea.find(".rghead .rgfn .bt-delete").click(function(){
var images_to_delete = new Array();
var delete_cover = false;
var doms_to_delete = new Array();
var thiscover = $(".description_loader .edit_fn .setcover").attr("href");
$(".description_loader .edit_fn .bt-dels").each(function(){
if($(this).hasClass("setdelete")){
images_to_delete.push($(this).attr("href"));
doms_to_delete.push($(this).parent().parent());
if(thiscover == $(this).attr("href"))
delete_cover = true;
}
})
if(confirm("Deleting "+images_to_delete.length+" image(s)?")){
$.post("delete_images",{"images":images_to_delete,"delete_cover":delete_cover,"aid":id},function(response){
if(response.success){
for(dom in doms_to_delete){
doms_to_delete[dom].hide("slide",function(){$(this).remove();})
}
}
g.albumArea.find(".rghead .rgfn .bt-delete").hide();
})
}
})
}
$("#filter").remove();
g.albumArea.css("margin-top","");
var head ='<a href="orbit_gallery?album='+id+'" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a></div>';
head+='<a class="bt-del bt-delete btn btn-primary pull-right" onclick="return false;" style="display:none;" title="<%= I18n.t("gallery.delete_selected") %>" href=""><i class="icon-trash icon-white"></i><%= I18n.t("gallery.delete_selected") %></a>';
head+='<a class="bt-save btn btn-primary pull-right" onclick="return false;" style="display:none;" title="Save" href=""><i class="icon-ok icon-white"></i>Save</a>';
g.albumArea.find(".rghead .rgfn").html(head);
g.albumArea.find("#imgholder").load("edit_album?aid="+id,function(data,response,xhr){
if(xhr.status == 404){
$(this).text("<%= I18n.t('gallery.album_not_found') %>");
return false;
}
bindHandlers();
g.albumArea.addClass('o_album_edit');
var imageTagArray = null;
$.getJSON("images_tags",function(data){
imageTagArray = eval(data);
})
bindHandlers();
}
this.saveTags = function(id,tagsfor){
this.saveTags = function(id,tagsfor,callbackFn){
var tagids = new Array();
g.tagList.find("li input:checked").each(function(){
tagids.push($(this).parent().attr("data-content"));
})
var tag = null;
if(g.loadArea == "images")
tag = "album";
else if(g.loadArea == "theater")
tag = "pic";
$.post("save_tags",{"id":id,"tag":tag,"tids":tagids},function(){
$.post("../save_tags",{"id":id,"tag":tagsfor,"tids":tagids},function(){
if(typeof callbackFn == "function")
callbackFn.call(this,tagids);
})
}
}
@@ -0,0 +1,278 @@
<%# encoding: utf-8 %>
$.extend($.expr[':'], {
'containsi': function (elem, i, match, array) {
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
}
});
var galleryAPI = function(){
g = this;
this.urlVars = rcom.getUrlVars();
this.albumArea = $("#orbit_gallery");
this.loadArea = null;
this.tagList = $(".taglist ul");
// this.authenticated = false;
this.initialize = function(callbackFn){
$(document).ready(function(){
//bindHandlers();
})
var bindHandlers = function(){
}
}
this.loadAlbums = function(id){
g.albumArea.find(".rghead .rgfn a").click(function(){g.makeNewAlbum($(this).attr("href"))});
g.albumArea.addClass('o_gallery');
g.albumArea.find("#imgholder").empty();
if(id!="all"){
var cids = [];
var tids = [];
var href = null;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++){
hash = hashes[i].split('=');
if(hash[0]=="cat"){
cids.push(hash[1]);
href = "cat="+hash[1];
}else if(hash[0]=="tag"){
tids.push(hash[1]);
href = "tag="+hash[1];
}
$("#filter .filter_btns a[href='"+href+"']").addClass("active");
}
if(cids.length == 0)
cids = "all";
}else{
var cids = "all";
}
$.getJSON("panel/gallery/front_end/get_albums",{"cid":cids,"tid":tids,"inner":true},function(categories){
$.each(categories,function(x,category){
$.each(category,function(i,album){
album.description = (album.description?album.description:"<%= I18n.t('gallery.no_description') %>")
if(album.cover == "default")
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><img src='../../../assets/gallery/default.jpg'/></a><span class='albumname'><a title='"+album.description+"' href='?album="+album._id+"'>"+album.name+"</a></span><span class='categoryname'><i class='icon-folder-close'></i> "+album.category_name+"</span><span class='tagnames'></span></div>");
else
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><img src='"+album.cover_path+"'/></a><span class='albumname'><a title='"+album.description+"' href='?album="+album._id+"'>"+album.name+"</a></span><span class='categoryname'><i class='icon-folder-close'></i> "+album.category_name+"</span><span class='tagnames'></span></div>");
var tag_string = "";
for(tag in album.tag_names){
if(tag == album.tag_names.length-1)
tag_string+= '<span class="tags">' + album.tag_names[tag] + '</span>';
else
tag_string+= '<span class="tags">' + album.tag_names[tag] + ', </span>';
}
$img.find(".tagnames").html(tag_string);
g.albumArea.find("#imgholder").append($img);
})
})
})
}
this.loadImages = function(id){
g.albumArea.addClass('o_album');
g.albumArea.find("#imgholder").empty();
$.getJSON("panel/gallery/front_end/albums/"+id+"/imgs",{inner:true},function(album){
$.each(album.images,function(i,image){
var thumb = image.file.thumb.url;
image.description = (image.description?image.description:"<%= I18n.t('gallery.no_description') %>")
var $img = $("<div class='rgphoto'><a title='"+image.description+"' href='"+image.theater_link+"'><img src='"+thumb+"'/></a></div>");
g.albumArea.find("#imgholder").append($img);
})
})
}
this.loadTheater = function(id){
var imageArray;
var imagecount = 0;
// var picHeight = 0;
var bindHandlers = function(){
var $slidelist = $('.slidelist'),
$rslide = $('.rslide'),
$rslidenav = $('.rslidenav'),
$img = $("#main_pic img"),
wHeight = $(window).height();
$("#main_pic").height("auto");
$img.css("height","auto");
var updatePhotoTag = function(){
var tagnames = imageArray[imagecount].tag_names;
g.tagList.empty();
for(tag in tagnames){
g.tagList.append("<li>"+tagnames[tag]+"</li>");
}
}
$(".slidectrl a.togglelist").click(function(){
var rslide_h = $rslide.outerHeight();
if ( $slidelist.height() < 1 ){
$slidelist.stop().animate({'height':rslide_h - 30}, 300);
$slidelist.find("ul").show();
} else {
$slidelist.stop().animate({'height':'0px'}, 300);
$slidelist.find("ul").hide();
}
})
$(".slidectrl .togglescreen").click(function(){
toggleFullscreen();
})
$(".slidectrl .browserfullscreen").click(function(){
browserFullScreen();
})
$slidelist.find(".list_element").click(function(){
imagecount = parseInt($(this).parent().attr("for"));
changeImage($(this));
})
$rslidenav.find(".navN").click(function(){
nextpic($(this));
})
$rslidenav.find("a.navP").click(function(){
prevpic($(this));
})
$("#nextpic").click(function(){
nextpic($(this));
})
$(document).keydown(function(e){
if (e.keyCode == 37){
prevpic($rslidenav.find(".navP"));
return false;
}
if(e.keyCode == 39){
nextpic($rslidenav.find(".navN"));
return false;
}
if(e.keyCode == 27){
toggleFullscreen();
$rslide.removeClass('browserFullScreen');
return false;
}
if(e.keyCode == 70 || e.keyCode == 102){
if($rslide.hasClass("fullscreen"))
browserFullScreen();
}
});
var browserFullScreen = function(){
var el = document.documentElement,
rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen;
rfs.call(el);
}
$(window).resize(function(){
if(window.innerWidth == screen.width && window.innerHeight == screen.height) {
$rslide.addClass('browserFullScreen');
} else {
$rslide.removeClass('browserFullScreen');
}
})
var nextpic = function(dom){
if(imagecount == imageArray.length - 1)
imagecount = 0;
else
imagecount++;
changeImage(dom);
}
var prevpic = function(dom){
if(imagecount == 0)
imagecount = imageArray.length - 1
else
imagecount--;
changeImage(dom);
}
var toggleFullscreen = function(){
if($rslide.hasClass("fullscreen")){
$rslide.css("position","relative");
$rslide.removeClass("fullscreen");
$(".slidectrl .browserfullscreen").hide();
$img.css({"padding":""})
$("#main_pic").height("auto");
}else{
$("#main_pic").height(wHeight);
$img.css("height","auto");
$rslide.css("position","");
$rslide.addClass("fullscreen");
$img.css({"padding":($rslide.height()-$img.height())/2})
$(".slidectrl .browserfullscreen").show();
}
}
var changeImage = function(dom){
var pageurl = dom.attr('href');
$img.fadeOut(200,function(){
if($rslide.hasClass("fullscreen"))
$img.attr({"src":dom.attr("data-content")}).css("height","100%");
else
$img.attr({"src":dom.attr("data-content")}).css("height","auto");
$img.fadeIn(200);
if($rslide.hasClass("fullscreen")){
$img.css({"padding":($rslide.height()-$img.height())/2})
}
$slidelist.stop().animate({'height':'0px'}, 300);
$slidelist.find("ul").hide();
if(rcom.getInternetExplorerVersion() == -1){
if(pageurl!=window.location){
pageurl = "gallery?id="+pageurl+"&controller_action=theater";
window.history.pushState({path:pageurl},'',pageurl);
}
}else{
window.location.hash = pageurl;
}
// $(".slideinfo b.info").text(imageArray[imagecount].title);
updatePhotoTag();
$(".slideinfo .info").text(imageArray[imagecount].description);
if(imageArray.length > 1)
updateNavigation();
})
}
var updateNavigation = function(){
var next, prev;
if(imagecount == 0){
next = 1;
prev = imageArray.length - 1;
}else if(imagecount == imageArray.length - 1){
next = 0
prev = imageArray.length - 2;
}else{
next = imagecount + 1;
prev = imagecount - 1;
}
$(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.url});
$(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.url});
};
if(imageArray.length > 1)
updateNavigation();
}
var preparestage = function(albumid){
$.getJSON("panel/gallery/front_end/albums/"+albumid+"/imgs",{"inner":true},function(album){
imageArray = eval(album.images);
$.each(album.images,function(i,image){
if(image._id == id)
imagecount = i;
})
bindHandlers();
})
}
if(rcom.getInternetExplorerVersion()!=-1){
var url_constructor = window.location.href.split("/");
var url = "";
for(x=0;x<=url_constructor.length-1;x++){
if(x == url_constructor.length-1){
url+="#!/"+url_constructor[x];
}else{
url+=url_constructor[x]+"/";
}
}
window.location.href = url;
}
var albumid = $("#main_pic").attr("data-content");
g.albumArea.css("margin-bottom","0");
// picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight());
preparestage(albumid);
}
}
galleryAPI.prototype.locale = "en";
@@ -4,7 +4,7 @@ $(function () {
'use strict';
// Initialize the jQuery File Upload widget:
$('#fileupload').fileupload({"aid" : parent.g.urlVars['album']},{
$('#fileupload').fileupload({
acceptFileTypes:/(\.|\/)(jpe?g|png)$/i,
headers:{
'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content")
@@ -1,16 +1,3 @@
/*html { background: #eee; }
body {
background: #fff;
width: 600px;
margin: 0 auto 20px auto;
padding: 20px 20px 0 20px;
border: solid 4px #ddd;
border-top: none;
}
body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #main1, .fullscreen #main2, .fullscreen #main, .fullscreen #content, .fullscreen #content2 { position: static; }
*/
.rg, .rgp {
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
@@ -18,11 +5,7 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
}
.rg input, .rgp input, .rg textarea, .rgp textarea {
resize: none;
border: none;
outline: none;
background: transparent;
margin: 0;
padding: 0;
display: block;
font-size: 13px;
}
@@ -33,14 +16,12 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
}
.rg a:hover { }
.rg img { display: block; border: none; width: 120px; height: 90px; }
.rg img { display: block; border: none;}
.rgmask { background: #000; width: 100%; position: fixed; top: 0; left: 0; }
.rgui {
background: transparent 0 0 url(../../../assets/gallery/rgui.png) no-repeat;
display: inline-block;
overflow: hidden;
cursor: pointer;
}
.rghead, .rgbody { overflow: hidden; }
@@ -59,10 +40,26 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
}
.rgfn { overflow: hidden; padding: 4px 10px; }
.rgalbum, .rgphoto { float: left; margin: 0 0 24px 0; }
.rgalbum, .rgphoto { float: left; margin: 0 10px 24px 0; }
.rgalbum {
width: 150px;
margin-bottom: 12px;
padding: 16px;
margin: 0 8px 8px 0;
border: solid 1px #ccc;
width: 300px;
height: 120px;
border-radius: 4px;
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
}
.rgalbum > a {
display: block;
float: left;
margin-right: 10px;
}
.rgalbum:hover {
box-shadow: 0 0 6px rgba(0,0,0,0.2);
}
.rgalbum img {
transition: all, 0.5s ease;
@@ -70,33 +67,32 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
-moz-transition: all 0.5s ease;
-ms-transition: all, 0.5s ease;
}
.rgphoto { width: 128px; }
.rgphoto img, .rgphoto_edit img {
.rgphoto { }
.rgphoto a {
display: block;
padding: 3px;
border: solid 1px #BFBFBF;
background: #fff;
padding: 4px;
border: solid 1px #ddd;
background-color: #fff;
border-radius: 4px;
transition: all, 0.3s ease;
-webkit-transition: all, 0.3s ease;
-moz-transition: all, 0.3s ease;
}
.rgphoto a:hover {
border-color: #999;
box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}
.rgphoto img, .rgphoto_edit img {
display: block;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
box-shadow: 0 1px 0 rgba(0,0,0,0.1);
-webkit-box-shadow: 0 1px 0 rgba(0,0,0,0.1);
-moz-box-shadow: 0 1px 0 rgba(0,0,0,0.1);
-ms-box-shadow: 0 1px 0 rgba(0,0,0,0.1);
transition: all, 0.3s ease;
-webkit-transition: all, 0.3s ease;
-moz-transition: all, 0.3s ease;
-ms-transition: all, 0.3s ease;
}
.rgphoto a:hover img {
border-color: #666;
}
.rgalbum .albumname {
font-size: 15px;
padding: 6px 0;
display: block;
transition: background 0.3s ease;
-webkit-transition: background 0.3s ease;
-moz-transition: background 0.3s ease;
@@ -110,13 +106,23 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
/* Photo Edit */
.albumname_edit label, .albumname_edit .rginput, .rgphoto_edit img, .rgphoto_edit .rginput { float: left; }
.rgphoto_edit, .albumname_edit { clear: both; overflow: hidden; }
.albumname_edit label { width: 128px; margin: 0 10px 0 0; text-align: right; padding: 0; line-height: 24px; }
.rgphoto_edit, .albumname_edit {
clear: both;
overflow: hidden;
margin-bottom: 10px;
}
.albumname_edit label {
width: 120px;
margin: 0 10px 0 0;
text-align: right;
padding: 0;
line-height: 24px;
}
.albumname_edit .rginput { }
.rgphoto_edit img { margin-right: 10px; }
.rgphoto_edit img { margin: 0 10px 10px 0; }
.rgphoto_edit .rginput { margin-right: 10px; }
.rgphoto_edit .edit_fn { }
.rgphoto_edit .edit_fn .bt-dels { margin-right: 4px; }
.rgphoto_edit .edit_fn { float: left; margin-bottom: 10px; }
.rgphoto_edit .edit_fn .bt-dels { }
/* Delete List */
.rglist { overflow: hidden; padding: 10px 0; }
@@ -140,7 +146,7 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
right: 0;
bottom: 0;
overflow: hidden;
background: #333;
background: #222;
clear: both;
/*z-index: 99;*/
min-height: 250px;
@@ -224,10 +230,14 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
border-left: solid 1px #222;
}
.slidectrl a.togglelist { background-position: 0 -30px; }
.slidectrl a.togglescreen { background-position: 0 -90px; }
.slidectrl a.toinline { background-position: -30px 0; }
.slidectrl a.sharebt { background-position: -30px -30px; }
.slidectrl a.browserfullscreen {background-position: -30px -30px; display:none;}
.slidectrl a.browserfullscreen { display:none;}
.slidectrl a.slidestop { background-position: 0 -60px; }
.fullscreen .slidectrl a.togglescreen { background-position: -30px -90px; }
.browserFullScreen .slidectrl a.browserfullscreen { background-position: -30px 0; }
.browserFullScreen .togglescreen { display: none; }
.slideinfo {
height: 30px;
line-height: 30px;
@@ -343,49 +353,23 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
}
.rgbt span {
padding: 0 12px 0 8px;
background: transparent right -106px url(../../../assets/gallery/rgui.png) no-repeat;
display: inline-block;
line-height: 30px;
height: 32px;
font-size: 14px;
}
.rgbt:hover span { background-position: right -296px; }
.rgbt:active span { background-position: right -486px; line-height: 31px; }
.rgbtsg {
padding: 0;
width: 30px;
height: 32px;
text-indent: -999px;
background-position: -358px 0;
padding: 6px;
}
/*
.bt-add { background-position: 0 -106px; }
.bt-add:hover { background-position: 0 -296px; }
.bt-add:active { background-position: 0 -486px; }
.bt-del { background-position: 0 -144px; }
.bt-del:hover { background-position: 0 -334px; }
.bt-del:active { background-position: 0 -524px; }
.bt-edit { background-position: 0 -182px; }
.bt-edit:hover { background-position: 0 -372px; }
.bt-edit:active { background-position: 0 -562px; }
.bt-back { background-position: 0 -676px; }
.bt-back:hover { background-position: 0 -714px; }
.bt-back:active { background-position: 0 -752px; }
.bt-save, .bt-finish { background-position: 0 -220px; }
.bt-save:hover, .bt-finish:hover { background-position: 0 -410px; }
.bt-save:active, .bt-finish:active { background-position: 0 -600px; }
*/
.rgphoto_edit .rgbtsg.active { display: inline-block; }
.bt-finish { display: block; float: right; clear: both; }
.bt-addnew {
margin: 0 auto;
width: 98px;
height: 100px;
text-indent: -9999px;
display: block;
}
.bt-addnew:hover { background-position: -106px 0; }
.bt-addnew:active { background-position: -212px 0; }
.bt-next{
background-position: 0 -258px;
display: block;
@@ -399,35 +383,12 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
right: 6px;
top: 6px;
}
/*
.bt-close:hover { background-position: -436px 0; }
.bt-close:active { background-position: -514px 0; }
.bt-cls { background-position: 0 -790px; }
.bt-cls:hover { background-position: 0 -828px; }
.bt-cls:active { background-position: 0 -866px; }
.bt-dels { background-position: -318px 0; width: 32px; }
.bt-dels:hover { background-position: -396px 0; }
.bt-dels:active { background-position: -474px 0; }
.bt-dels.setdelete { background-position: -474px -38px; width: 32px; }
.bt-cover { background-position: -318px -38px; width: 32px; }
.bt-cover:hover { background-position: -358px -38px; }
.bt-cover:active { background-position: -398px -38px; }
.bt-cover.setcover { background-position: -438px -38px; }
.bt-chk { background-position: -318px -76px; width: 16px; height: 16px; margin-right: 4px; }
.bt-chk:hover { background-position: -342px -76px; }
.bt-chk.check { background-position: -366px -76px; }
.bt-languages { background-position: -398px -72px; width: 32px; position: relative; }
.bt-languages:hover { background-position: -438px -72px; }
.bt-languages:active { background-position: -477px -72px; }
*/
.inputui {
background: transparent 0 0 url(../../../assets/gallery/inputui.png) no-repeat;
padding: 0 0 0 4px;
margin: 0 0 8px 0;
}
.inputui span {
background: transparent 0 0 url(../../../assets/gallery/inputui.png) no-repeat;
padding: 0 4px 0 0;
display: block;
}
@@ -435,23 +396,23 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
.rginput input, .rginput textarea { color: #999; }
.rginput.focus input, .rginput.focus textarea { color: #333; }
.rgih26 { width: 208px; background-position: 0 0; }
.rgih26 span { background-position: right 0; height: 26px; }
.rgih26 input { width: 100%; line-height: 26px; height: 26px; }
.rgih26.focus { background-position: 0 -34px; }
.rgih26.focus span { background-position: right -34px; }
.rgih68 { width: 396px; background-position: 0 -68px; }
.rgih68 span { background-position: right -68px; padding: 3px 4px 3px 0; }
.rgih26 { width: 208px; }
.rgih26 span { }
.rgih26 input { width: 376px; }
.rgih26.focus { }
.rgih26.focus span { }
.rgih68 { width: 396px; }
.rgih68 span { padding: 3px 4px 3px 0; }
.rgih68 textarea { width: 392px; height: 62px; }
.rgih68.focus { background-position: 0 -144px; }
.rgih68.focus span { background-position: right -144px; }
.rgih98 { width: 396px; background-position: 0 -220px; }
.rgih98 span { background-position: right -220px; padding: 3px 4px 3px 0; }
.rgih98 textarea { width: 376px; height: 92px; }
.rgih98.focus { background-position: 0 -326px; }
.rgih98.focus span { background-position: right -326px; }
.rgih68.focus { }
.rgih68.focus span { }
.rgih98 { width: 396px; }
.rgih98 span { }
.rgih98 textarea { width: 376px; height: 80px; }
.rgih98.focus { }
.rgih98.focus span { }
.w380 { width: 380px; }
.w380 { width: 386px; }
#imgholder { overflow: hidden; }
@@ -524,10 +485,11 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
}
.tag_search input[type=text] {
box-shadow: none;
width: 170px;
width: 92px;
height: 25px;
line-height: 25px;
padding: 3px 6px 3px 24px;
border: 0;
border-top: solid 1px #fff;
}
.tag_search input[type=text]:focus {
@@ -539,6 +501,15 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
top: 50%;
margin-top: -7px;
}
#tag_panel .tag_save {
position: absolute;
right: 0;
bottom: 0;
height: 31px;
border-left: solid 1px #ccc;
background-color: #fff;
padding: 2px 4px 0 4px;
}
/* orbit style implementation */
@@ -556,8 +527,28 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
display: block;
}
#orbit_gallery .btn { margin: 0; }
#orbit_gallery .btn i { margin-right: 4px; }
#orbit_gallery .rgfn .btn {
margin-left: 8px;
}
#orbit_gallery .rgfn i { margin-right: 4px; }
#orbit_gallery .form-actions { background-color: whiteSmoke; }
.o_gallery .tagnames {
display: block;
margin-top: 6px;
}
.o_gallery .label-tags {
display: inline-block;
margin: 0 6px 6px 0;
}
.o_gallery .rgbody, .o_album .rgbody {
padding: 10px 8px;
}
#categories .add-album .control-label {
text-align: left;
width: 100px;
padding-left: 12px;
padding-right: 12px;
}
@@ -0,0 +1,329 @@
.rg, .rgp {
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
}
.rg input, .rgp input, .rg textarea, .rgp textarea {
resize: none;
margin: 0;
display: block;
font-size: 13px;
}
.rgp textarea { overflow: auto; }
.rg a, .rgp a {
text-decoration: none;
outline: none;
}
.rg a:hover { }
.rg img { display: block; border: none; }
.rgmask { background: #000; width: 100%; position: fixed; top: 0; left: 0; }
.rgui {
display: inline-block;
cursor: pointer;
}
.rghead, .rgbody { overflow: hidden; }
.rghead {
padding: 10px 0;
}
.rgtitle {
color: #333;
text-shadow: 0 1px 0 #ddd;
font-size: 2em;
padding: 0 8px;
}
.rgbody {
}
.rgfn { overflow: hidden; }
.rgalbum, .rgphoto { float: left; margin: 0 10px 24px 0; }
.rgalbum {
margin: 0 16px 16px 0;
padding: 6px;
width: 138px;
height: 220px;
border: solid 1px #ccc;
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
}
.rgalbum > a {
display: block;
float: none;
margin: -6px -6px 0 -6px;
}
.rgalbum img {
transition: all, 0.5s ease;
-webkit-transition: all, 0.5s ease;
-moz-transition: all 0.5s ease;
-ms-transition: all, 0.5s ease;
}
.rgphoto { }
.rgphoto a {
display: block;
transition: all, 0.3s ease;
-webkit-transition: all, 0.3s ease;
-moz-transition: all, 0.3s ease;
}
.rgphoto a:hover img {
opacity: 0.85;
}
.rgphoto img, .rgphoto_edit img {
display: block;
transition: all, 0.3s ease;
-webkit-transition: all, 0.3s ease;
-moz-transition: all, 0.3s ease;
}
.rgalbum .albumname {
font-size: 1.25em;
line-height: ;
margin: 6px 0;
display: block;
height: 45px;
overflow: hidden;
transition: background 0.3s ease;
-webkit-transition: background 0.3s ease;
-moz-transition: background 0.3s ease;
-ms-transition: background 0.3s ease;
}
.rgalbum a:hover img {
opacity: 0.85;
}
.rgalbum .categoryname {}
.rgalbum .tagnames {
display: block;
margin-top: 8px;
padding-top: 8px;
line-height: 22px;
height: 22px;
overflow: hidden;
border-top: solid 1px #ccc;
color: #666;
}
.taglist {
padding: 10px 0;
}
.taglist_title {
font-size: 1.5em;
margin: 0 0 10px 0;
}
.taglist ul {
padding: 10px 0;
border-top: solid 1px #ddd;
overflow: hidden;
}
.taglist li {
float: left;
margin: 0 8px 8px 0;
}
.rgp .rgtitle { margin: 0 0 10px 0; }
/* Ruling Slide */
.rslide {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
background: #222;
clear: both;
/*z-index: 99;*/
min-height: 250px;
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
}
.rslide.fullscreen { position: fixed; z-index: 99; }
.rslideinside {
}
.comp {
width: 100%;
height: auto;
overflow: hidden;
position: relative;
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
}
.comp img{ display: block; width: auto; height: auto; margin: 0 auto; cursor: pointer; min-height: 250px; }
.comp .full{ width: auto; height: auto; max-width: 100%; max-height: 100%; }
.rslidenav {
position: absolute;
top: 50%;
left: 0;
right: 0;
margin-top: -35px;
}
.rslidenav a {
position: absolute;
display: block;
width: 30px;
height: 40px;
overflow: hidden;
text-indent: -999px;
background: #000 0 center url(../../../assets/gallery/slidenav.png) no-repeat;
background: rgba(0,0,0,0.9) 0 0 url(../../../assets/gallery/slidenav.png) no-repeat;
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
}
.rslidenav a:hover {
background-color: #fff;
background-color: rgba(255,255,255,0.9);
}
.rslidenav .navP { left: 0; border-radius: 0 4px 4px 0; background-position: 0 -40px; }
.rslidenav .navN { right: 0; border-radius: 4px 0 0 4px; background-position: -30px 0; }
.rslidenav a.navP:hover { background-position: -30px -40px; }
.rslidenav a.navN:hover { background-position: 0 0; }
.slidectrl {
position: absolute;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 30px;
background: #000 left top url(../../../assets/gallery/slidetitlebg.png) repeat-x;
background: rgba(0,0,0,0.9) left top url(../../../assets/gallery/slidetitlebg.png) repeat-x;
/*z-index: 999;*/
}
.slidectrl a {
display: block;
float: right;
text-indent: -9999px;
overflow: hidden;
width: 30px;
height: 30px;
background: transparent 0 0 url(../../../assets/gallery/slideui.gif) no-repeat;
border-left: solid 1px #222;
}
.slidectrl a.togglelist { background-position: 0 -30px; }
.slidectrl a.togglescreen { background-position: 0 -90px; }
.slidectrl a.toinline { background-position: -30px 0; }
.slidectrl a.sharebt { background-position: -30px -30px; }
.slidectrl a.browserfullscreen { display:none;}
.slidectrl a.slidestop { background-position: 0 -60px; }
.fullscreen .slidectrl a.togglescreen { background-position: -30px -90px; }
.browserFullScreen .slidectrl a.browserfullscreen { background-position: -30px 0; }
.browserFullScreen .togglescreen { display: none; }
.slideinfo {
height: 30px;
line-height: 30px;
color: #fff;
font-size: 13px;
overflow: hidden;
}
.slideinfo .info { padding: 0 0 0 6px; text-transform: uppercase; }
.slideinfo span.info { color: #ccc; text-transform: none; }
.slidelist {
position: absolute;
bottom: 30px;
z-index: 99;
width: 100%;
height: 0;
overflow: auto;
overflow-x: hidden;
background: transparent 0 0 url(../../../assets/gallery/slidelistbg.png);
}
.slidelist ul {
margin: 0 auto;
padding: 10px 0 10px 10px;
list-style: none;
}
.slidelist li {
display: inline-block;
margin: 0 10px 10px 0;
}
.slidelist a {
border: solid 2px #fff;
display: block;
width: 120px;
height: 90px;
position: relative;
box-shadow: 0 0 6px rgba(0,0,0,0.7);
-webkit-box-shadow: 0 0 6px rgba(0,0,0,0.7);
-moz-box-shadow: 0 0 6px rgba(0,0,0,0.7);
-ms-box-shadow: 0 0 6px rgba(0,0,0,0.7);
}
.slidelist a.playall {
border: none;
width: 80px;
height: 32px;
margin: 31px 0 0 22px;
background: transparent 0 0 url(../../../assets/gallery/playall.png) no-repeat;
box-shadow: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
-ms-box-shadow: none;
}
.slidelist a.playall:hover { background-position: 0 -32px; }
#li_play_all { width: 124px; height: 94px; }
.slidelist img {
margin: 0;
background: #fff;
display: block;
transition: all 0.2s ease;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-ms-transition: all 0.2s ease;
}
.slidelist a:hover img {
padding: 4px;
margin: -4px;
}
.dm {
background: #fff;
border: solid 1px #a4a4a4;
border-right-color: #666;
position: absolute;
overflow: hidden;
padding: 2px 0;
display: none;
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
}
.dm ul { margin: 0; padding: 0; list-style: none !important; }
.dm li {
margin: 0;
padding: 0;
border-bottom: solid 1px #ccc;
list-style: none !important;
}
.dm li a {
display: block;
padding: 6px 10px;
font-size: 13px;
transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
}
.dm li a:hover { background: #eee; }
/* orbit style implementation */
#orbit_gallery {
margin: 0 -10px 30px -10px;
}
@@ -0,0 +1,34 @@
class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController
include AdminHelper
# before_filter :force_order_for_visitor,:only=>[:index]
before_filter :force_order_for_user#,:except => [:index]
def show
if is_manager? || is_admin? || is_sub_manager?
@authenticated = true #turn this value to false for view only
else
@authenticated = false
end
@tags = GalleryTag.all
@image = GalleryImage.find(params[:id])
@albumid = @image.gallery_album_id
@album = GalleryAlbum.find(@albumid)
@images = @album.gallery_images.all
end
def destroy
images = params['images']
images.each do |image|
img = GalleryImage.find(image)
img.delete
end
if params['delete_cover'] == "true"
album = GalleryAlbum.find(params['id'])
album.update_attributes(:cover=>"default")
end
render :json =>{"success"=>true}.to_json
end
end
Loaded 100 of 601 files, more files were not shown because too many files have changed in this diff. Show more