Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Veranstaltungen-Feature #58

Merged
merged 9 commits into from
Oct 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ group :development do
gem 'better_errors' # see Railscasts #402
gem 'binding_of_caller'
gem 'meta_request'

gem 'letter_opener'
end

# Security Tools
Expand Down
10 changes: 9 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ PATH
best_in_place (~> 2.1.0)
cancan
carrierwave
delocalize
devise (= 2.2.3)
edit_mode (>= 1.0.0)
fnordmetric
Expand All @@ -62,6 +63,7 @@ PATH
gmaps4rails (>= 2.0.0.pre)
gravatar_image_tag
haml
icalendar
jquery-fileupload-rails
jquery-rails
less (= 2.2.0)
Expand Down Expand Up @@ -180,6 +182,8 @@ GEM
daemons (1.1.9)
database_cleaner (0.9.1)
debug_inspector (0.0.2)
delocalize (0.4.0)
rails (>= 3.0)
devise (2.2.3)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
Expand Down Expand Up @@ -260,6 +264,7 @@ GEM
hike (1.2.3)
hiredis (0.4.5)
i18n (0.6.11)
icalendar (2.2.0)
journey (1.0.4)
jquery-fileupload-rails (0.4.1)
actionpack (>= 3.1)
Expand All @@ -278,6 +283,8 @@ GEM
less-rails (2.2.6)
actionpack (>= 3.1)
less (~> 2.2.0)
letter_opener (1.2.0)
launchy (~> 2.2)
libv8 (3.16.14.3)
listen (2.4.0)
celluloid (>= 0.15.2)
Expand Down Expand Up @@ -307,7 +314,7 @@ GEM
orm_adapter (0.5.0)
passgen (1.0.2)
pdf-core (0.2.5)
phony (2.4.1)
phony (2.5.3)
poltergeist (1.5.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
Expand Down Expand Up @@ -533,6 +540,7 @@ DEPENDENCIES
jquery-ui-rails
json
launchy
letter_opener
mail!
mailman
mercury-rails!
Expand Down
8 changes: 8 additions & 0 deletions app/assets/javascripts/datatables.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ ready = ->
"order": [[1, "desc"]],
"pageLength": 100
}, common_configuration))
$('.datatable.events').dataTable(jQuery.extend({
"order": [[1, "desc"]],
"pageLength": 100,
columnDefs: [
{ type: 'de_date', targets: 1}
]
}, common_configuration))


$(document).ready(ready)
$(document).on('page:load', ready)
2 changes: 2 additions & 0 deletions app/assets/stylesheets/wingolf_layout/box.css.sass
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
h1
padding: 7px 0 0 9px
margin: 0
input
width: 75%

.box.first
background: repeat scroll 0 0 transparent !important
Expand Down
54 changes: 54 additions & 0 deletions app/assets/stylesheets/wingolf_layout/events.css.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
table.event_details
th
text-align: left
td
width: 75%
tr
vertical-align: top
tr.description
textarea
height: 100px
input, textarea
width: 100%

form#invite
margin: 20px
margin-bottom: 40px
textarea
width: 98%
height: 200px
padding: 1%

ul.upcoming_events
padding-left: 6px
margin: 6px
li.upcoming_event
list-style-type: none
margin-bottom: 6px
.event.name
display: block

.ics_export_buttons, .ics_abo_buttons
float: right
position: relative
top: -44px
left: -3px
height: 0
width: 600px

#ics_export, #ics_abo
float: right

#ics_abo.btn
position: relative
top: -7px
left: 2px

table.events_footer
margin-left: 6px
width: 98%
vertical-align
td
vertical-align: bottom
td.create_event
text-align: right
13 changes: 13 additions & 0 deletions app/assets/stylesheets/wingolf_layout/fonts.css.sass
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ form.formtastic fieldset ol li
p.inline-hints
font-weight: normal

textarea
font-size: 12px

// Profile Fields
//
ul.attributes, ul.profile_fields
Expand Down Expand Up @@ -237,3 +240,13 @@ div.workflow_steps
font-weight: bold
.brick-description
font-weight: normal

// Events
span.event.info
font-family: FontAwesome
font-size: 8pt
span.event.name
//font-family: FontAwesome
font-size: 11pt


2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def current_ability
options = {}
options[:preview_as_user] = true if params[:preview_as] == 'user'

@current_ability ||= ::Ability.new(current_user, options)
@current_ability ||= ::Ability.new(current_user, params, options)
end

end
64 changes: 54 additions & 10 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class Ability
include CanCan::Ability

def initialize(user, options = {})
def initialize(user, params = {}, options = {})
preview_as_user = true if options[:preview_as_user]

# Define abilities for the passed in user here. For example:
Expand Down Expand Up @@ -118,6 +118,19 @@ def initialize(user, options = {})
user_group_membership.user == user
end

# All users can join events.
#
can :read, Event
can :join, Event
can :leave, Event
can :index_events, User do |other_user|
other_user == user
end

# Name auto completion
#
can :autocomplete_title, User

# LOCAL ADMINS
# Local admins can manage their groups, this groups' subgroups
# and all users within their groups. They can also execute workflows.
Expand Down Expand Up @@ -154,7 +167,19 @@ def initialize(user, options = {})
#
can :export_member_list, Group do |group|
user.in? group.officers_of_self_and_parent_groups
end
end

# Local officers can create events in their groups.
#
can :create_event, Group do |group|
user.in? group.officers_of_self_and_parent_groups
end
can :update, Event do |event|
user.in? event.group.officers_of_self_and_parent_groups
end
can :update, Group do |group|
group.has_flag?(:contact_people) && can?(:update, group.parent_events.first)
end

# DEVELOPERS
can :use, Rack::MiniProfiler do
Expand All @@ -163,15 +188,34 @@ def initialize(user, options = {})

end

else # not logged in

# Imprint
# Make sure all users (even if not logged in) can read the imprint.
#
can :read, Page do |page|
page.has_flag? :imprint
end
end # not logged in:

# Imprint
# Make sure all users (even if not logged in) can read the imprint.
#
can :read, Page do |page|
page.has_flag? :imprint
end

# Listing Events and iCalendar (ICS) Export:
#
# There are event lists on public websites and webcal feeds.
# Therefore the user might not be logged in through a regular
# session. Some public feeds can be seen by anyone. Other
# feeds require an auth token.
#
can :index_events, Group do |group|
# Any registered user (identified by an auth token)
# can index the events of any group.
params[:token].present? && UserAccount.find_by_auth_token(params[:token])
end
can :index_events, User do |other_user|
# To index the events relevant to a certain user,
# one has to provide the correct auth token that corresponds
# to that user.
params[:token].present? && (UserAccount.find_by_auth_token(params[:token]) == other_user.account)
end
can :index_public_events, :all

end
end
8 changes: 8 additions & 0 deletions app/views/events/_invitation_text.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Liebe Bundesbrüder,

ich möchte euch auf folgende Wingolfsveranstaltung hinweisen.

[ Informationen zur Veranstaltung werden vom System hier eingefügt. ]

Mit wingolfitischen Grüßen
<%= "#{current_user.name} Z! #{current_user.aktivitaetszahl}" %>
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@


# Mailer Settings
config.action_mailer.delivery_method = :sendmail
config.action_mailer.delivery_method = :letter_opener # :sendmail
config.action_mailer.default_url_options = { host: 'localhost', port: 3000, protocol: 'https' }

end
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# get "angular_test", controller: "angular_test", action: "index"

resources :posts
resources :events

match "users/new/:alias" => "users#new"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This migration comes from your_platform (originally 20141008101744)
class AddLocationToEvents < ActiveRecord::Migration
def change
add_column :events, :location, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This migration comes from your_platform (originally 20141010130344)
class AddPublishOnWebsiteToEvents < ActiveRecord::Migration
def change
add_column :events, :publish_on_global_website, :boolean
add_column :events, :publish_on_local_website, :boolean
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This migration comes from your_platform (originally 20141010134227)
class AddAuthTokenToUserAccounts < ActiveRecord::Migration
def change
add_column :user_accounts, :auth_token, :string
end
end
10 changes: 7 additions & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20140808223512) do
ActiveRecord::Schema.define(:version => 20141010134300) do

create_table "activities", :force => true do |t|
t.integer "trackable_id"
Expand Down Expand Up @@ -75,8 +75,11 @@
t.text "description"
t.datetime "start_at"
t.datetime "end_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "location"
t.boolean "publish_on_global_website"
t.boolean "publish_on_local_website"
end

create_table "flags", :force => true do |t|
Expand Down Expand Up @@ -197,6 +200,7 @@
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "auth_token"
end

add_index "user_accounts", ["reset_password_token"], :name => "index_user_accounts_on_reset_password_token", :unique => true
Expand Down
Loading