diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css.scss similarity index 54% rename from app/assets/stylesheets/application.css rename to app/assets/stylesheets/application.css.scss index 60be1365..e60e1c25 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css.scss @@ -17,73 +17,98 @@ body { margin: 0; } -a { + +.content { + font-family: sans-serif; + padding: 0 15px; color: #898989; + + a { + color: #898989; + } + + h1 { + color: #337389; + } + + .button { + background-color: #dc4136; + color: #ffffff; + padding: 0.5em; + border-radius: 5px; + margin: 0 1em; + text-decoration: none; + } } +/* Navigation Bar */ .topbar { padding: 0 15px; background-color: #eff0ec; font-family: sans-serif; -} -.topbar a { - text-decoration: none; - color: #898989; -} + a { + text-decoration: none; + color: #898989; + } -.topbar h1 { - display: inline-block; + h1 { + display: inline-block; + } + + .button { + background-color: #898989; + color: #eff0ec; + padding: 0.5em; + border-radius: 5px; + margin: 0 1em; + text-decoration: none; + } } .navigation { display: inline-block; -} -.navigation li { - padding: 0 5px; - display: inline-block; - list-style: none; + li { + padding: 0 5px; + display: inline-block; + list-style: none; + } } +/* Admin Show Page */ .row li { display: inline-block; width: 150px; } -.content { - font-family: sans-serif; - padding: 0 15px; - color: #898989; -} +/* New Events Page (Form) */ +.form_field { + margin-top: 0.75em; -.button { - border: 1px solid grey; - padding: 0.5em; - border-radius: 5px; - background-color: #eff0ec; - margin: 0 1em; - text-decoration: none; -} + p { + margin: 0; + } -.topbar .button { - background-color: #898989; - color: #eff0ec; -} + input[type=text] { + width: 35em; + } -.form_field { - margin-top: 0.75em; + textarea { + width: 35em; + height: 10em; + } } -.form_field p { - margin: 0; -} +.date { + overflow: hidden; -.form_field input[type=text] { - width: 35em; -} + .left { + float: left; + margin-right: 10px; + } -.form_field textarea { - width: 35em; - height: 10em; -} \ No newline at end of file + .right { + float: left; + } +} diff --git a/app/controllers/applications_controller.rb b/app/controllers/applications_controller.rb index 4b0a884a..1582cdce 100644 --- a/app/controllers/applications_controller.rb +++ b/app/controllers/applications_controller.rb @@ -1,19 +1,16 @@ class ApplicationsController < ApplicationController http_basic_authenticate_with name: ENV['DT_USERNAME'], password: ENV['DT_PASSWORD'], only: :show + before_action :get_event, only: [:show, :new, :create] def show - @event = Event.find(params[:event_id]) @application = @event.applications.find(params[:id]) end def new - @event = Event.find(params[:event_id]) @application = @event.applications.build end def create - @event = Event.find(params[:event_id]) - @application = Application.new(application_params) @application.event = @event if @application.save @@ -27,4 +24,8 @@ def create def application_params params.require(:application).permit(:name, :email, :email_confirmation, :answer_1, :answer_2, :answer_3) end + + def get_event + @event = Event.find(params[:event_id]) + end end diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index fa36f6c7..3b8ffb53 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -1,5 +1,6 @@ class EventsController < ApplicationController http_basic_authenticate_with name: ENV['DT_USERNAME'], password: ENV['DT_PASSWORD'], only: [:admin_index, :admin_show, :edit] + before_action :get_event, only: [:admin_show, :edit, :update] def index @events = Event.approved @@ -10,7 +11,6 @@ def admin_index end def admin_show - @event = Event.find(params[:id]) respond_to do |format| format.html format.csv { send_data @event.to_csv } @@ -36,12 +36,9 @@ def create end def edit - @event = Event.find(params[:id]) end def update - @event = Event.find(params[:id]) - if @event.update(event_params) redirect_to admin_path else @@ -53,4 +50,8 @@ def update def event_params params.require(:event).permit(:organizer_name, :organizer_email, :organizer_email_confirmation, :description, :name, :start_date, :end_date, :question_1, :question_2, :question_3, :approved) end + + def get_event + @event = Event.find(params[:id]) + end end diff --git a/app/views/events/new.html.erb b/app/views/events/new.html.erb index 8befd236..cf823ef8 100644 --- a/app/views/events/new.html.erb +++ b/app/views/events/new.html.erb @@ -14,93 +14,94 @@ <%= form_for :event, url: events_path do |f| %>
-

- <%= f.label :organizer_name %> -

-

- <%= f.text_field :organizer_name %> -

-
+

+ <%= f.label :organizer_name %> +

+

+ <%= f.text_field :organizer_name %> +

+
-

- <%= f.label :organizer_email %> -

-

- <%= f.text_field :organizer_email %> -

-
+

+ <%= f.label :organizer_email %> +

+

+ <%= f.text_field :organizer_email %> +

+
-

- <%= f.label :organizer_email_confirmation %> -

-

- <%= f.text_field :organizer_email_confirmation %> -

-
+

+ <%= f.label :organizer_email_confirmation %> +

+

+ <%= f.text_field :organizer_email_confirmation %> +

+
-

- <%= f.label :description %> -

- <%= f.text_area :description %> -
+

+ <%= f.label :description %> +

+ <%= f.text_area :description %> +
-

- <%= f.label :name %> -

-

- <%= f.text_field :name %> -

-
+

+ <%= f.label :name %> +

+

+ <%= f.text_field :name %> +

+ -
-

- <%= f.label :start_date %> -

-

- <%= f.date_field :start_date %> -

-
+
+
+

+ <%= f.label :start_date %> +

+

+ <%= f.date_field :start_date %> +

+
-
-

- <%= f.label :end_date %> -

-

- <%= f.date_field :end_date %> -

-
+
+

+ <%= f.label :end_date %> +

+

+ <%= f.date_field :end_date %> +

+
+
-

- <%= f.label :question_1 %> -

-

- <%= f.text_field :question_1 %> -

-
+

+ <%= f.label :question_1 %> +

+

+ <%= f.text_field :question_1 %> +

+
-

- <%= f.label :question_2 %> -

-

- <%= f.text_field :question_2 %> -

-
+

+ <%= f.label :question_2 %> +

+

+ <%= f.text_field :question_2 %> +

+
-

- <%= f.label :question_3 %> -

-

- <%= f.text_field :question_3 %> -

-
- +

+ <%= f.label :question_3 %> +

+

+ <%= f.text_field :question_3 %> +

+

<%= f.submit %>