diff --git a/app/uploaders/gprs_uploader.rb b/app/uploaders/gprs_uploader.rb new file mode 100644 index 00000000..4ce41321 --- /dev/null +++ b/app/uploaders/gprs_uploader.rb @@ -0,0 +1,61 @@ +class GprsUploader < CarrierWave::Uploader::Base + + # Include RMagick or ImageScience support: + # include CarrierWave::RMagick + # include CarrierWave::ImageScience + include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + # storage :file + # storage :s3 + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "gprs/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process :scale => [200, 300] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process :scale => [50, 50] + # end + + version :thumb do + process :resize_to_fill => [150, 120] + end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + # def extension_white_list + # %w(jpg jpeg gif png) + # end + + # Override the filename of the uploaded files: + # def filename + # "something.jpg" if original_filename + # end + +# def manipulate! +# raise current_path.inspect +# image = ::MiniMagick::Image.open(current_path) +# image = yield(image) +# image.write(current_path) +# ::MiniMagick::Image.open(current_path) +# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e +# raise CarrierWave::ProcessingError.new("Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: #{e}") +# end + +end + diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index 112e2845..545c5fbb 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -105,7 +105,7 @@ <% end -%> <% end -%> -<%= content_tag :li, :class => active_for_controllers('cals','calendar_categories') || active_for_app_auth("calendar") do -%> +<%= content_tag :li, :class => active_for_controllers('cals') || active_for_app_auth("calendar") do -%> <%= link_to content_tag(:i, nil, :class => 'icons-calendar') + content_tag(:span, t('admin.calendar')), panel_calendar_back_end_cals_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('cals','calendar_categories') ) do -%> <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> @@ -116,6 +116,17 @@ <%#= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %> <% end -%> <% end %> +<%= content_tag :li, :class => active_for_controllers('locations') || active_for_app_auth("gprs") do -%> + <%= link_to content_tag(:i, nil, :class => 'icons-link') + content_tag(:span, t('admin.gprs')), panel_gprs_back_end_locations_path %> + <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('locations') ) do -%> + <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> + <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> + <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> + <%#= content_tag :li, link_to((t('calendar.calendars') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_calendar_back_end_cal_path), :class => active_for_action('cals','new') %> + <%#= content_tag :li, link_to(t('gallery.tags'), panel_gallery_back_end_tags_path), :class => active_for_action('/panel/gallery/back_end/tags', 'index') %> + <%#= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %> + <% end -%> +<% end %> <%= content_tag :li, :class => (active_for_controllers('writing_journals', '/panel/personal_journal/back_end/tags', 'writing_journal_categorys', 'approvals') || active_for_app_auth('PersonalJournal') ) do -%> <%= link_to content_tag(:i, nil, :class => 'icons-personal_journal') + t('admin.personal_journal'), panel_personal_journal_back_end_writing_journals_path %> diff --git a/config/locales/en.yml b/config/locales/en.yml index efe8612a..b638ccb1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -130,6 +130,7 @@ en: attributes: Attributes author: Author calendar: Calendar + gprs: GPRS cant_delete_self: You can not delete yourself. cant_revoke_self_admin: You can not revoke your admin role yourself. category: Category diff --git a/vendor/built_in_modules/calendar/app/assets/javascripts/calendarAPI.js.erb b/vendor/built_in_modules/calendar/app/assets/javascripts/calendarAPI.js.erb index 2b8b2b02..78089ac7 100644 --- a/vendor/built_in_modules/calendar/app/assets/javascripts/calendarAPI.js.erb +++ b/vendor/built_in_modules/calendar/app/assets/javascripts/calendarAPI.js.erb @@ -15,7 +15,7 @@ var calendarAPI = function(){ }) var bindHandlers = function(){ $(".event").live("click",function(){ - c.displayEvent(); + c.displayEvent($(this)); }) $("#create_event_btn").click(function(){ @@ -115,6 +115,8 @@ var calendarAPI = function(){ $.getJSON("cals/getEvents",{"type":"monthview","month":month,"year":year},function(events){ var $eventrow = $(""); var nos = new Array(); + var currow = 0; + var lastno = 0; nos.push(0); $.each(events,function(i,evnt){ var daydom = $("#calendar_month td[date="+evnt.start_date+"]"); @@ -124,28 +126,51 @@ var calendarAPI = function(){ var thisno = daydom.attr("no"); var index = "new"; + var smallcount = 0; + for(x in nos){ - if(thisno < nos[x]){ - $eventrow = null; - $eventrow = $(""); + if(thisno > nos[x]){ + smallcount++; + } + if(smallcount > 0){ index = x; break; } } + if(index == "new"){ + nos=[] + $eventrow = null; + $eventrow = $(""); + } + + if(thisrow!=currow){ + $eventrow = null; + $eventrow = $(""); + + } + if(index!="new"){ - nos[index] = (thisno + evnt.total_days) - 1; + nos[index] = (parseInt(thisno) + parseInt(evnt.total_days)) - 1; }else{ - nos.push((thisno + evnt.total_days) - 1); + nos.push((parseInt(thisno) + parseInt(evnt.total_days)) - 1); } if(pos == 1){ - $eventrow.html('
'+evnt.title+'
'); + $eventrow.html('
'+evnt.title+'
'); }else{ if($eventrow.html()==""){ $eventrow.append(''); + }else{ + if((lastno+1)!=thisno){ + var inposition = $eventrow.find("td.main_td").attr("pos"); + var colspan = parseInt(pos) - parseInt(inposition); + colspan--; + $eventrow.append(''); + } } - $eventrow.append('
'+evnt.title+'
'); + $eventrow.append('
'+evnt.title+'
'); } - + lastno = (parseInt(thisno) + parseInt(evnt.total_days)) - 1; + currow = thisrow; curparent.append($eventrow); }) }) @@ -195,9 +220,14 @@ var calendarAPI = function(){ $("tr[for="+domfor+"]").remove(); }) } - this.displayEvent = function(){ - - c.event_quick_view_div.show() + this.displayEvent = function(dom){ + var url = dom.attr("link"); + c.event_quick_view_div.load(url,function(){ + c.event_quick_view_div.show() + c.event_quick_view_div.find(".event-close-btn").click(function(){ + c.event_quick_view_div.empty().hide(); + }) + }) } c.initialize(); } diff --git a/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css b/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css index 421f8334..85b0390f 100644 --- a/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css +++ b/vendor/built_in_modules/calendar/app/assets/stylesheets/calendar.css @@ -265,7 +265,7 @@ /* Event Controller */ .event_controller { - width: 300px; + width: 350px; } .event_controller .row-fluid { margin-bottom: 6px; diff --git a/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/cals_controller.rb b/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/cals_controller.rb index 4c42e0d4..6330e95b 100644 --- a/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/cals_controller.rb +++ b/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/cals_controller.rb @@ -58,7 +58,7 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController def get_events month = params[:month] year = params[:year] - events = Event.where(:start_month => month).and(:start_year => year) + events = Event.where(:start_month => month).and(:start_year => year).asc(:start_date) @events = Array.new events.each do |event| # @temp = Array.new @@ -66,8 +66,9 @@ class Panel::Calendar::BackEnd::CalsController < OrbitBackendController 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} + @events << {"start_date"=>event.start_date, "total_days" => no_of_days, "title" => event.title,"color"=>color,"show_link"=>panel_calendar_back_end_event_path(event)} end + @events = @events.sort{|k,v| v[:total_days] <=> k[:total_days]} render :json => @events.to_json end diff --git a/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/events_controller.rb b/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/events_controller.rb index 0dca026f..ea319cdb 100644 --- a/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/events_controller.rb +++ b/vendor/built_in_modules/calendar/app/controllers/panel/calendar/back_end/events_controller.rb @@ -1,5 +1,5 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController - + include Panel::Calendar::BackEnd::CalsHelper def new @calendars = Cal.all @event = Event.new @@ -55,4 +55,14 @@ class Panel::Calendar::BackEnd::EventsController < OrbitBackendController h.js end end -end \ No newline at end of file + def show + @event = Event.find(params[:id]) + @start_month_name = Date::ABBR_MONTHNAMES[@event.start_month] + @end_month_name = Date::ABBR_MONTHNAMES[@event.end_month] + @start_day_name = getDayName(@event.start_date,@event.start_month,@event.start_year) + @end_day_name = getDayName(@event.end_date,@event.end_month,@event.end_year) + render :layout=>false + end +end + + diff --git a/vendor/built_in_modules/calendar/app/helpers/panel/calendar/back_end/cals_helper.rb b/vendor/built_in_modules/calendar/app/helpers/panel/calendar/back_end/cals_helper.rb index 60a14ffa..3f937552 100644 --- a/vendor/built_in_modules/calendar/app/helpers/panel/calendar/back_end/cals_helper.rb +++ b/vendor/built_in_modules/calendar/app/helpers/panel/calendar/back_end/cals_helper.rb @@ -61,5 +61,10 @@ module Panel::Calendar::BackEnd::CalsHelper monthsdays << 31 return monthsdays end + def getDayName(date,month,year) + dt = Date.new(year,month,date) + name = Date::ABBR_DAYNAMES[dt.wday] + return name + end end \ No newline at end of file diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/index.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/index.html.erb index 98a237af..96701aaf 100644 --- a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/index.html.erb +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/index.html.erb @@ -62,7 +62,7 @@ - + diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/events/show.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/events/show.html.erb index 0791c7bd..c65a2fa6 100644 --- a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/events/show.html.erb +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/events/show.html.erb @@ -1,10 +1,15 @@