add announcemnet connect feature(not finished)
This commit is contained in:
parent
ed088e74be
commit
3b6d3480ed
|
@ -118,6 +118,10 @@ class Admin::CalendarsController < OrbitAdminController
|
|||
@event = Event.find(params[:id])
|
||||
p = event_page_params
|
||||
p["update_user_id"] = current_user.id
|
||||
bulletin = @event.bulletin
|
||||
if !bulletin.nil?
|
||||
bulletin.update_attributes(calendar_start_date: p[:start],calendar_end_date: p[:end],calendar_all_day: p[:all_day],calendar_type_id: p[:calendar_type_id])
|
||||
end
|
||||
if @event.update_attributes(p)
|
||||
e = @event.to_json
|
||||
e = JSON.parse(e)
|
||||
|
@ -136,6 +140,10 @@ class Admin::CalendarsController < OrbitAdminController
|
|||
# DELETE /events/1.json
|
||||
def destroy
|
||||
@event = Event.find(params[:id])
|
||||
bulletin = @event.bulletin
|
||||
if !bulletin.nil?
|
||||
bulletin.update_attributes(event_id: nil,add_to_calendar: '0')
|
||||
end
|
||||
@event.destroy
|
||||
render :json => {"success"=>true}.to_json
|
||||
# respond_to do |format|
|
||||
|
|
|
@ -11,19 +11,21 @@ class Event
|
|||
field :note
|
||||
field :start, type: DateTime
|
||||
field :end, type: DateTime
|
||||
field :all_day, type: Boolean
|
||||
field :recurring, type: Boolean
|
||||
field :all_day, type: Boolean,default: false
|
||||
field :recurring, type: Boolean,default: false
|
||||
field :frequency
|
||||
field :period
|
||||
field :create_user_id
|
||||
field :update_user_id
|
||||
|
||||
field :bulletin_id
|
||||
belongs_to :calendar_type
|
||||
attr_accessor :agenda_start, :agenda_end, :get_agenda_events
|
||||
|
||||
|
||||
validates_presence_of :title, :message => "Please fill the title of the Event"
|
||||
|
||||
def bulletin
|
||||
Bulletin.find(self.bulletin_id) rescue nil
|
||||
end
|
||||
def self.format_date(date_time)
|
||||
Time.at(date_time.to_i).to_formatted_s(:db)
|
||||
end
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<div class="control-group">
|
||||
<%= f.label :title, :class=>"control-label" %>
|
||||
<%= f.label t("title"), :class=>"control-label" %>
|
||||
<div class="controls">
|
||||
<%= f.text_field :title %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<%= f.label :note, :class=>"control-label" %>
|
||||
<%= f.label t("calendar.note"), :class=>"control-label" %>
|
||||
<div class="controls">
|
||||
<%= f.text_area :note, :rows => 3 %>
|
||||
</div>
|
||||
|
@ -24,12 +24,12 @@
|
|||
<label class="control-label"></label>
|
||||
<div class="controls">
|
||||
<label>
|
||||
<%= f.check_box :all_day,:id=>"all_day_check", :checked => @all_day %> All Day
|
||||
<%= f.check_box :all_day,:id=>"all_day_check", :checked => @all_day %> <%= t('calendar.all_day') %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<%= f.label :start, :class=>"control-label" %>
|
||||
<%= f.label t("start_date"), :class=>"control-label" %>
|
||||
<%#= f.datetime_select :start %>
|
||||
<div class="controls">
|
||||
<div data-date-format="yyyy/MM/dd hh:mm" data-language="en" data-picktime="true" class="input-append datetimepick">
|
||||
|
@ -44,7 +44,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<%= f.label :end, :class=>"control-label" %>
|
||||
<%= f.label t("end_date"), :class=>"control-label" %>
|
||||
<%#= f.datetime_select :end %>
|
||||
<div class="controls">
|
||||
<div data-date-format="yyyy/MM/dd hh:mm" data-language="en" data-picktime="true" class="input-append datetimepick">
|
||||
|
@ -60,7 +60,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<%= f.label "Calendar", :class=>"control-label" %>
|
||||
<%= f.label t("calendar.calendar"), :class=>"control-label" %>
|
||||
<div class="controls">
|
||||
<%= f.select :calendar_type_id, @categories.collect{|t| [ t.title, t.id ]} %>
|
||||
</div>
|
||||
|
@ -69,15 +69,15 @@
|
|||
<label class="control-label"></label>
|
||||
<div class="controls">
|
||||
<label>
|
||||
<%= f.check_box :recurring, :id=>"recurring_checkbox", :checked => @recurring %> Recurring
|
||||
<%= f.check_box :recurring, :id=>"recurring_checkbox", :checked => @recurring %> <%= t("calendar.recurring") %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="recurring_panel" <%= (@recurring ? '' : "style=display:none;") %> >
|
||||
<div class="control-group">
|
||||
<%=f.label :period, "Repeats",:class=>"control-label" %>
|
||||
<%=f.label :period, t("calendar.repeats"),:class=>"control-label" %>
|
||||
<div class="controls">
|
||||
<%=f.select :period, Event::REPEATS,{},:class=>"span5" %>
|
||||
<%=f.select :period, Event::REPEATS.map{|v| [t("calendar.#{v.downcase}"),v]},{},:class=>"span5" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
|
|
@ -9,3 +9,11 @@ en:
|
|||
select_calendar: "Select Calendar"
|
||||
categories: Categories
|
||||
new_category: New Category
|
||||
all_day: All Day
|
||||
note: Note
|
||||
repeats: Repeats
|
||||
recurring: Recurring
|
||||
daily: Daily
|
||||
weekly: Weekly
|
||||
monthly: Monthly
|
||||
yearly: Yearly
|
||||
|
|
|
@ -7,3 +7,11 @@ zh_tw:
|
|||
save: 儲存
|
||||
select_calendar: 選取行事曆
|
||||
categories: 類別
|
||||
all_day: 全天
|
||||
note: 註記
|
||||
repeats: 重複
|
||||
recurring: 週期性
|
||||
daily: 每天
|
||||
weekly: 每週
|
||||
monthly: 每月
|
||||
yearly: 每年
|
Loading…
Reference in New Issue