├── .envrc ├── .gitignore ├── .travis.yml ├── Capfile ├── Gemfile ├── Gemfile.lock ├── README.md ├── Rakefile ├── TODO ├── app ├── assets │ ├── fonts │ │ ├── Merriweather │ │ │ ├── Merriweather-Black.ttf │ │ │ ├── Merriweather-Bold.ttf │ │ │ ├── Merriweather-BoldItalic.ttf │ │ │ ├── Merriweather-HeavyItalic.ttf │ │ │ ├── Merriweather-Italic.ttf │ │ │ ├── Merriweather-Light.ttf │ │ │ ├── Merriweather-LightItalic.ttf │ │ │ └── Merriweather-Regular.ttf │ │ ├── Montserrat-Bold.ttf │ │ ├── Montserrat-Medium.ttf │ │ ├── Montserrat-SemiBold.ttf │ │ ├── OpenSans-Bold.ttf │ │ ├── OpenSans-BoldItalic.ttf │ │ ├── OpenSans-ExtraBold.ttf │ │ ├── OpenSans-ExtraBoldItalic.ttf │ │ ├── OpenSans-Italic.ttf │ │ ├── OpenSans-Light.ttf │ │ ├── OpenSans-LightItalic.ttf │ │ ├── OpenSans-Regular.ttf │ │ ├── OpenSans-Semibold.ttf │ │ ├── OpenSans-SemiboldItalic.ttf │ │ ├── OpenSans │ │ │ ├── OpenSans-Bold-webfont.eot │ │ │ ├── OpenSans-Bold-webfont.svg │ │ │ ├── OpenSans-Bold-webfont.ttf │ │ │ ├── OpenSans-Bold-webfont.woff │ │ │ ├── OpenSans-Regular-webfont.eot │ │ │ ├── OpenSans-Regular-webfont.svg │ │ │ ├── OpenSans-Regular-webfont.ttf │ │ │ └── OpenSans-Regular-webfont.woff │ │ ├── TitilliumWeb-Black.ttf │ │ ├── TitilliumWeb-Bold.ttf │ │ └── TitilliumWeb-SemiBold.ttf │ ├── images │ │ ├── .keep │ │ ├── 50percent-logo-source.svg │ │ ├── 50percent-logo-white.svg │ │ ├── flags │ │ │ ├── de.png │ │ │ ├── en.png │ │ │ ├── es.png │ │ │ ├── fr.png │ │ │ └── it.png │ │ ├── logo_header.png │ │ └── marie-curie-speakerinnen.jpg │ ├── javascripts │ │ ├── admin │ │ │ └── comments.js │ │ └── application.js │ └── stylesheets │ │ ├── _admin.scss │ │ ├── _article.scss │ │ ├── _comments.scss │ │ ├── _forms.scss │ │ ├── _sidebar.scss │ │ ├── _typography.scss │ │ ├── admin │ │ ├── comments.scss │ │ ├── events.scss │ │ ├── images.scss │ │ ├── pages.scss │ │ └── start.scss │ │ ├── application.scss │ │ ├── blog-variables.scss │ │ ├── blog.scss │ │ ├── blog_posts.scss │ │ ├── custom.scss │ │ ├── header.scss │ │ └── variables.scss ├── controllers │ ├── admin │ │ ├── base_controller.rb │ │ ├── blog_categories_controller.rb │ │ ├── comments_controller.rb │ │ ├── events_controller.rb │ │ ├── home_controller.rb │ │ ├── images_controller.rb │ │ └── pages_controller.rb │ ├── application_controller.rb │ ├── blog_categories_controller.rb │ ├── blog_pages_controller.rb │ ├── blog_posts_controller.rb │ ├── comments_controller.rb │ ├── concerns │ │ └── .keep │ ├── events_controller.rb │ ├── pages_controller.rb │ ├── sessions_controller.rb │ └── users_controller.rb ├── helpers │ ├── admin │ │ ├── comments_helper.rb │ │ ├── events_helper.rb │ │ └── pages_helper.rb │ ├── application_helper.rb │ ├── blog_categories_helper.rb │ ├── blog_posts_helper.rb │ ├── events_helper.rb │ ├── sessions_helper.rb │ └── users_helper.rb ├── mailers │ ├── .keep │ └── notifications_mailer.rb ├── models │ ├── .keep │ ├── article.rb │ ├── blog_category.rb │ ├── comment.rb │ ├── concerns │ │ └── .keep │ ├── event.rb │ ├── image.rb │ ├── page.rb │ └── user.rb ├── uploaders │ └── file_uploader.rb └── views │ ├── admin │ ├── blog_categories │ │ ├── _blog_category.html.erb │ │ ├── _form.html.erb │ │ ├── edit.html.erb │ │ ├── index.html.erb │ │ ├── new.html.erb │ │ └── show.html.erb │ ├── comments │ │ ├── _comment.html.erb │ │ ├── _filter_form.html.erb │ │ ├── destroy.js.erb │ │ ├── edit.html.erb │ │ ├── hide.js.erb │ │ ├── index.html.erb │ │ ├── publish.js.erb │ │ ├── show.html.erb │ │ └── uncheck.js.erb │ ├── events │ │ ├── _event.html.erb │ │ ├── _filter_form.html.erb │ │ ├── edit.html.erb │ │ ├── hide.js.erb │ │ ├── index.html.erb │ │ ├── publish.js.erb │ │ ├── show.html.erb │ │ └── uncheck.js.erb │ ├── home │ │ └── start.html.erb │ ├── images │ │ ├── _form.html.erb │ │ ├── edit.html.erb │ │ ├── index.html.erb │ │ ├── new.html.erb │ │ └── show.html.erb │ └── pages │ │ ├── _form_fields.html.erb │ │ ├── _page.html.erb │ │ ├── edit.html.erb │ │ ├── index.html.erb │ │ ├── new.html.erb │ │ └── show.html.erb │ ├── blog_pages │ └── show.html.erb │ ├── blog_posts │ ├── _post.html.erb │ ├── index.html.erb │ └── show.html.erb │ ├── events │ ├── _all_events_donut.html.erb │ ├── _comment.html.erb │ ├── _comment_form.html.erb │ ├── _donut.html.erb │ ├── _event.html.erb │ ├── _form_fields.html.erb │ ├── _tag_or_search_summery.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── new.html.erb │ └── show.html.erb │ ├── kaminari │ ├── _first_page.html.erb │ ├── _gap.html.erb │ ├── _last_page.html.erb │ ├── _next_page.html.erb │ ├── _page.html.erb │ ├── _paginator.html.erb │ └── _prev_page.html.erb │ ├── layouts │ ├── admin.html.erb │ ├── application.html.erb │ └── blog.html.erb │ ├── notifications_mailer │ └── new_event.html.erb │ ├── pages │ └── show.html.erb │ ├── sessions │ └── new.html.erb │ ├── shared │ ├── _admin_menu.html.erb │ ├── _blog_header.html.erb │ ├── _blog_sidebar.html.erb │ ├── _debug.html.erb │ ├── _facebook_meta_tags.html.erb │ ├── _header.html.erb │ └── _sidebar.html.erb │ └── users │ └── new.html.erb ├── bin ├── bundle ├── rails ├── rake ├── setup ├── update └── yarn ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── database.yml.dist ├── deploy.rb ├── deploy │ ├── production.rb │ └── staging.rb ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── application_controller_renderer.rb │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── content_security_policy.rb │ ├── cookies_serializer.rb │ ├── date_time_formats.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── kaminari_config.rb │ ├── mime_types.rb │ ├── new_framework_defaults_5_2.rb │ ├── new_framework_defaults_6_1.rb │ ├── permissions_policy.rb │ ├── rack-attack.rb │ ├── session_store.rb │ └── wrap_parameters.rb ├── locales │ ├── de.yml │ ├── en.yml │ └── kaminari.yml ├── puma.rb ├── routes.rb ├── secrets.yml.dist ├── spring.rb └── storage.yml ├── db ├── migrate │ ├── 20140830194951_create_events.rb │ ├── 20140908141549_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb │ ├── 20140908141550_add_missing_unique_indices.acts_as_taggable_on_engine.rb │ ├── 20140908141551_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb │ ├── 20140908141552_add_missing_taggable_index.acts_as_taggable_on_engine.rb │ ├── 20140909171557_create_users.rb │ ├── 20141030153330_rename_country_on_event_to_country_code.rb │ ├── 20141106174525_add_text_organizers_to_events.rb │ ├── 20141106180938_add_internal_info_to_events.rb │ ├── 20141109113302_add_published_date_to_events.rb │ ├── 20141126210657_add_remark_to_events.rb │ ├── 20141230123146_create_comments.rb │ ├── 20150207190850_remove_published_at_from_comments.rb │ ├── 20150219104002_add_mod_state_to_events.rb │ ├── 20150222101012_create_pages.rb │ ├── 20150222201454_create_translation_table_for_pages.rb │ ├── 20150227153932_rename_page_location_to_page_type.rb │ ├── 20150308121020_create_blog_categories.rb │ ├── 20150308121937_create_join_table_blog_category_page.rb │ ├── 20150308233046_create_images.rb │ ├── 20150312210330_add_body_to_events.rb │ ├── 20150313153715_add_more_contact_info_to_events.rb │ ├── 20151208163422_add_more_contact_info_for_event_organizer_to_events.rb │ ├── 20151209141300_add_public_attribute_to_pages.rb │ ├── 20180918194313_change_collation_for_tag_names.acts_as_taggable_on_engine.rb │ └── 20180918194314_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb ├── schema.rb └── seeds.rb ├── doc └── moved-events-from-old-wp-blog.txt ├── lib ├── assets │ ├── .keep │ └── blog_import.xml ├── capistrano │ └── tasks │ │ └── util.rake └── tasks │ ├── .keep │ └── blog_import.rake ├── log └── .keep ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico └── robots.txt ├── test ├── controllers │ ├── .keep │ ├── admin │ │ ├── comments_controller_test.rb │ │ └── events_controller_test.rb │ ├── blog_posts_controller_test.rb │ ├── comments_controller_test.rb │ ├── events_controller_test.rb │ ├── pages_controller_test.rb │ ├── sessions_controller_test.rb │ └── users_controller_test.rb ├── fixtures │ ├── .keep │ ├── blog_categories.yml │ ├── comments.yml │ ├── events.yml │ ├── images.yml │ ├── pages.yml │ └── users.yml ├── helpers │ ├── .keep │ ├── sessions_helper_test.rb │ └── users_helper_test.rb ├── integration │ └── .keep ├── mailers │ ├── .keep │ └── mailer_test.rb ├── models │ ├── .keep │ ├── comment_test.rb │ ├── event_test.rb │ ├── page_test.rb │ └── user_test.rb └── test_helper.rb └── vendor └── assets ├── javascripts └── .keep └── stylesheets └── .keep /.envrc: -------------------------------------------------------------------------------- 1 | PATH_add bin 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/*.log 16 | /tmp 17 | 18 | .DS_Store 19 | database.yml 20 | secrets.yml 21 | .rake_tasks 22 | 23 | public/assets 24 | public/images 25 | public/uploads 26 | 27 | .ruby-version 28 | 29 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 2.6.3 3 | services: 4 | - postgresql 5 | before_script: 6 | - cp config/database.yml.dist config/database.yml 7 | - psql -c 'create database fiftypercent_test;' -U postgres 8 | - bundle exec rake db:migrate 9 | script: 10 | - bundle exec rake test 11 | -------------------------------------------------------------------------------- /Capfile: -------------------------------------------------------------------------------- 1 | # Load DSL and Setup Up Stages 2 | require 'capistrano/setup' 3 | require 'capistrano/deploy' 4 | 5 | require 'capistrano/rails' 6 | require 'capistrano/bundler' 7 | 8 | require "capistrano/scm/git" 9 | install_plugin Capistrano::SCM::Git 10 | 11 | # Loads custom tasks from `lib/capistrano/tasks' if you have any defined. 12 | Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } 13 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | ruby '3.1.2' 3 | 4 | gem 'rails', '~> 6.1.7' 5 | 6 | # used in the rail 5.2 version 7 | gem 'bootsnap', '~> 1.3' 8 | 9 | gem 'pg', '~> 1.4.6' 10 | 11 | gem 'jquery-rails' 12 | gem 'uglifier', '>= 2.7.0' 13 | gem 'execjs' 14 | # gem 'therubyracer', platforms: :ruby 15 | gem 'mini_racer' 16 | 17 | gem 'bcrypt' 18 | gem 'rails-i18n' 19 | gem 'globalize' 20 | gem 'kaminari' 21 | gem 'acts-as-taggable-on' 22 | gem 'carrierwave', '~> 1.3.1' 23 | 24 | gem 'bootstrap', '~> 4.3.1' 25 | gem "bootstrap_form", ">= 4.0.0.alpha1" 26 | gem 'font-awesome-rails', '~> 4.7.0.3' 27 | gem 'sass-rails', '~> 5.0.6' 28 | gem 'morrisjs-rails' 29 | gem 'raphael-rails' 30 | gem 'country_select', '~> 4.0.0' 31 | gem 'redcarpet', '~> 3.4.0' 32 | 33 | gem 'nokogiri' 34 | 35 | gem 'rack-attack', '~> 5.4.2' 36 | gem 'exception_notification' 37 | gem 'mimemagic', '~> 0.3.7' 38 | 39 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 40 | # gem 'jbuilder', '~> 2.0' 41 | 42 | group :development do 43 | gem 'puma' 44 | # gem 'quiet_assets' 45 | gem 'capistrano', '~> 3.4', require: false 46 | gem 'capistrano-rails', '~> 1.1', require: false 47 | gem 'capistrano-passenger', require: false 48 | gem 'listen' 49 | end 50 | 51 | group :test do 52 | gem 'minitest-reporters' 53 | gem 'rails-controller-testing' 54 | end 55 | 56 | group :test, :development do 57 | gem 'pry-rails' 58 | # gem 'spring' 59 | gem 'faker' 60 | end 61 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 💬 [50 Percent](https://50prozent.speakerinnen.org) 2 | 3 | __[50 Percent](https://50prozent.speakerinnen.org) wants to document how much women* are misrepresented as speakers at conferences, on panels, in talkshows and many other public events. At each event we count male and female speakers and publish the percentage of each - with your help!__ 4 | 5 | It is a Rails application maintained by the rubymonstas. 6 | 7 | See also: [Speakerinnen](https://speakerinnen.org) and the [blog](https://blog.speakerinnen.org) 8 | 9 | [![Build Status](https://travis-ci.com/rubymonsters/fiftypercent.svg?branch=master)](https://travis-ci.com/rubymonsters/fiftypercent) 10 | 11 | 12 | ## Development setup 13 | 14 | Time to open your Terminal! 👩‍💻 15 | 16 | 1. Clone the project `git clone git@github.com:rubymonsters/fiftypercent.git` 17 | 2. Switch to the project folder `cd fiftypercent` 18 | 3. Create your own database file `cp config/database_example.yml config/database.yml` 19 | 4. Install Postgres for the database following [their guide for your operating system](https://www.postgresql.org/download/) 20 | - If necessary, set up a new user [as described in this guide](https://www.digitalocean.com/community/tutorials/how-to-use-roles-and-manage-grant-permissions-in-postgresql-on-a-vps--2): 21 | ``` 22 | sudo su - postgres # log in with the postgres user 23 | psql # enter the Postgres database 24 | CREATE ROLE yourusername; # create a new user 25 | ALTER ROLE yourusername WITH LOGIN CREATEDB; # give necessary rights to database user 26 | ``` 27 | 5. Make sure you have the correct Ruby version installed. We recommend [Ruby Version Manager (RVM)](https://rvm.io/) (you can also use [rbenv](https://github.com/rbenv/rbenv), but setup is more difficult). Also best uninstall any Ruby installation from your operating system as it might conflict. Run these commands to install RVM and switch to Ruby 2.4.2 which we use: 28 | ``` 29 | gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB 30 | \curl -sSL https://get.rvm.io | bash -s stable 31 | rvm install "ruby-2.4.2" 32 | ``` 33 | 6. Install bundler `gem install bundler` 34 | 7. Install dependencies using `bundle install` 35 | 8. Create the database 36 | ``` 37 | rake db:create 38 | rake db:migrate 39 | ``` 40 | 9. Start the server with `rails s` 41 | 10. Open your browser and go to http://0.0.0.0:3000 42 | 43 | **🎉 Now you are set up to contribute code! :)** 44 | 45 | - Once you made changes, you can run the tests with `rake test`. 46 | - The code can be deployed to production using `cap production deploy`. If you want to deploy a specific branch, use `cap production deploy BRANCH=branchname` 47 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | * use https://github.com/kickstarter/rack-attack to prevent mass-submission of events -------------------------------------------------------------------------------- /app/assets/fonts/Merriweather/Merriweather-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/Merriweather/Merriweather-Black.ttf -------------------------------------------------------------------------------- /app/assets/fonts/Merriweather/Merriweather-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/Merriweather/Merriweather-Bold.ttf -------------------------------------------------------------------------------- /app/assets/fonts/Merriweather/Merriweather-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/Merriweather/Merriweather-BoldItalic.ttf -------------------------------------------------------------------------------- /app/assets/fonts/Merriweather/Merriweather-HeavyItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/Merriweather/Merriweather-HeavyItalic.ttf -------------------------------------------------------------------------------- /app/assets/fonts/Merriweather/Merriweather-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/Merriweather/Merriweather-Italic.ttf -------------------------------------------------------------------------------- /app/assets/fonts/Merriweather/Merriweather-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/Merriweather/Merriweather-Light.ttf -------------------------------------------------------------------------------- /app/assets/fonts/Merriweather/Merriweather-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/Merriweather/Merriweather-LightItalic.ttf -------------------------------------------------------------------------------- /app/assets/fonts/Merriweather/Merriweather-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/Merriweather/Merriweather-Regular.ttf -------------------------------------------------------------------------------- /app/assets/fonts/Montserrat-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/Montserrat-Bold.ttf -------------------------------------------------------------------------------- /app/assets/fonts/Montserrat-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/Montserrat-Medium.ttf -------------------------------------------------------------------------------- /app/assets/fonts/Montserrat-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/Montserrat-SemiBold.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans-Bold.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans-BoldItalic.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans-ExtraBold.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans-ExtraBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans-ExtraBoldItalic.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans-Italic.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans-Light.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans-LightItalic.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans-Semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans-Semibold.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans-SemiboldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans-SemiboldItalic.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans/OpenSans-Bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans/OpenSans-Bold-webfont.eot -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans/OpenSans-Bold-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans/OpenSans-Bold-webfont.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans/OpenSans-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans/OpenSans-Bold-webfont.woff -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans/OpenSans-Regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans/OpenSans-Regular-webfont.eot -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans/OpenSans-Regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans/OpenSans-Regular-webfont.ttf -------------------------------------------------------------------------------- /app/assets/fonts/OpenSans/OpenSans-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/OpenSans/OpenSans-Regular-webfont.woff -------------------------------------------------------------------------------- /app/assets/fonts/TitilliumWeb-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/TitilliumWeb-Black.ttf -------------------------------------------------------------------------------- /app/assets/fonts/TitilliumWeb-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/TitilliumWeb-Bold.ttf -------------------------------------------------------------------------------- /app/assets/fonts/TitilliumWeb-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/fonts/TitilliumWeb-SemiBold.ttf -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/images/50percent-logo-source.svg: -------------------------------------------------------------------------------- 1 | logo experimentsCreated with Sketch.5Percent 2 | -------------------------------------------------------------------------------- /app/assets/images/flags/de.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/images/flags/de.png -------------------------------------------------------------------------------- /app/assets/images/flags/en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/images/flags/en.png -------------------------------------------------------------------------------- /app/assets/images/flags/es.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/images/flags/es.png -------------------------------------------------------------------------------- /app/assets/images/flags/fr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/images/flags/fr.png -------------------------------------------------------------------------------- /app/assets/images/flags/it.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/images/flags/it.png -------------------------------------------------------------------------------- /app/assets/images/logo_header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/images/logo_header.png -------------------------------------------------------------------------------- /app/assets/images/marie-curie-speakerinnen.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/assets/images/marie-curie-speakerinnen.jpg -------------------------------------------------------------------------------- /app/assets/javascripts/admin/comments.js: -------------------------------------------------------------------------------- 1 | // Place all the behaviors and hooks related to the matching controller here. 2 | // All this logic will automatically be available in application.js. 3 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. 9 | // 10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require_tree . 16 | 17 | //= require popper 18 | //= require bootstrap 19 | //= require raphael 20 | //= require morris 21 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_admin.scss: -------------------------------------------------------------------------------- 1 | $admin-link-color: $admin-steel-blue; 2 | 3 | .admin { 4 | 5 | @import "admin/*"; 6 | .nav-item a.nav-link { 7 | color: white; 8 | margin: 0 20px; 9 | } 10 | 11 | a { 12 | color: $admin-link-color; 13 | &.btn { 14 | color: white; 15 | } 16 | &.btn:hover { 17 | color: $very-dark-grey; 18 | } 19 | &.btn-primary { 20 | color: $very-dark-grey; 21 | } 22 | } 23 | 24 | .btn-secondary { 25 | background-color: $admin-steel-blue; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_article.scss: -------------------------------------------------------------------------------- 1 | article { 2 | padding: 20px; 3 | margin-bottom: 40px; 4 | border: 2px solid $light-grey; 5 | border-radius: $border-radius-large; 6 | background-color: $body-bg; 7 | 8 | .where-when { 9 | margin-top: 6px; 10 | padding-top: 8px; 11 | margin-bottom: 10px; 12 | font-weight: bold; 13 | font-size: 18px; 14 | } 15 | 16 | .who-speaks { 17 | padding: 10px 0; 18 | font-size: 24px; 19 | font-weight: bold; 20 | } 21 | 22 | .badge { 23 | background-color: $grey; 24 | color: white; 25 | &:hover { 26 | background-color: $body-color; 27 | } 28 | } 29 | 30 | .bt { 31 | padding: 10px 0; 32 | border-top: 1px solid $content-line; 33 | } 34 | } 35 | 36 | .comment { 37 | padding: 16px; 38 | background-color: white; 39 | margin-bottom: 12px; 40 | 41 | h3 { 42 | margin-top: 4px; 43 | font-size: 18px; 44 | } 45 | .byline { 46 | border-bottom: 1px solid $content-line; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_comments.scss: -------------------------------------------------------------------------------- 1 | .new_comment { 2 | margin-bottom: 48px; 3 | #comment_body { 4 | height: 300px; 5 | } 6 | } 7 | 8 | .btn-success { 9 | background: $dark-grey; 10 | border-color: #FFF; 11 | } 12 | 13 | .btn-success:hover { 14 | background: #FFF; 15 | border-color: $dark-grey; 16 | color: $dark-grey; 17 | } 18 | 19 | .help-block { 20 | color: $dark-grey; 21 | } 22 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_forms.scss: -------------------------------------------------------------------------------- 1 | form.new_event, form.new_comment { 2 | margin-top: 2em; 3 | margin-bottom: 3em; 4 | .form-group { 5 | margin-bottom: 2em; 6 | } 7 | fieldset { 8 | margin-bottom: 3em; 9 | } 10 | legend { 11 | color: $content-background; 12 | background-color: $body-color; 13 | padding: 2px 6px; 14 | border: 0px; 15 | } 16 | #event_woman, #event_total { 17 | width: 80px; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_sidebar.scss: -------------------------------------------------------------------------------- 1 | #sidebar { 2 | min-height: 150px; 3 | padding: 20px; 4 | background-color: $content-background; 5 | border: 1px solid $light-grey; 6 | 7 | #tag_cloud { 8 | line-height: 1.6em; 9 | 10 | .s { font-size: 0.8em; } 11 | .m { font-size: 1.2em; } 12 | .l { font-size: 1.8em; } 13 | } 14 | 15 | h6 { 16 | color: $very-dark-grey; 17 | margin-bottom: 6px; 18 | text-transform: uppercase; 19 | padding-top: 30px; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_typography.scss: -------------------------------------------------------------------------------- 1 | html, body { 2 | font-family: 'OpenSans'; 3 | } 4 | 5 | h1, h2, h3, h4, h5, h6 { 6 | font-family: 'Montserrat'; 7 | } 8 | 9 | h1 { 10 | font-weight: bold; 11 | } -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/comments.scss: -------------------------------------------------------------------------------- 1 | .comments { 2 | .title { 3 | border-left: 4px solid silver; 4 | } 5 | .mod-state-ok .title { 6 | border-left-color: green; 7 | } 8 | .mod-state-hidden .title { 9 | border-left-color: Crimson; 10 | } 11 | .last { 12 | border-right: 1px solid #ccc; 13 | } 14 | 15 | .commentable { 16 | color: #999; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/events.scss: -------------------------------------------------------------------------------- 1 | #filter-form { 2 | margin-bottom: 12px; 3 | } 4 | 5 | #published-events { 6 | .title { 7 | border-left: 6px solid silver; 8 | } 9 | .mod-state-ok .title { 10 | border-left-color: #2BB124 11 | } 12 | .mod-state-hidden .title { 13 | border-left-color: #C4004A; 14 | } 15 | .last { 16 | border-right: 1px solid #ccc; 17 | } 18 | } 19 | 20 | .edit_event { 21 | legend { 22 | background-color: $body-color; 23 | color: $content-background; 24 | padding-left: 8px; 25 | } 26 | 27 | #event_body { 28 | height: 300px; 29 | font-family: "Lucida Console", Monaco, "Courier New", Courier, monospace; 30 | font-size: 12px; 31 | } 32 | } 33 | 34 | a.internal-info { 35 | color: #999; 36 | cursor: w-resize; 37 | &:hover { 38 | text-decoration: none; 39 | } 40 | } 41 | 42 | .popover{ 43 | max-width:540px; 44 | } 45 | 46 | 47 | .event-properties { 48 | h4 { 49 | border-bottom: 1px solid gray; 50 | color: gray; 51 | margin-top: 20px; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/images.scss: -------------------------------------------------------------------------------- 1 | .image-table { 2 | td.image img{ 3 | width: 100px; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/pages.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Pages controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | 5 | .page-form { 6 | textarea { 7 | min-height: 400px; 8 | } 9 | } 10 | .form-horizontal label.col-form-label { 11 | text-align: right; 12 | margin-bottom: 0; 13 | padding: 0px; 14 | } 15 | -------------------------------------------------------------------------------- /app/assets/stylesheets/admin/start.scss: -------------------------------------------------------------------------------- 1 | 2 | .overview { 3 | margin-top: 50px; 4 | .card-body li a { 5 | font-size: 130%; 6 | padding: 10px 15px; 7 | &:hover { 8 | text-decoration: none; 9 | background-color: #eeeeee; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any styles 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 | * file per style scope. 12 | * 13 | *= require_self 14 | *= require morris 15 | */ 16 | 17 | // Custom bootstrap variables must be set or imported *before* bootstrap. 18 | 19 | // To override the bootstrap variables 20 | 21 | // our partials 22 | @import "variables"; 23 | @import "typography"; 24 | @import "font-awesome"; 25 | @import "bootstrap"; 26 | @import "custom"; 27 | @import "header"; 28 | @import "article"; 29 | @import "comments"; 30 | @import "forms"; 31 | @import "sidebar"; 32 | @import "admin"; 33 | -------------------------------------------------------------------------------- /app/assets/stylesheets/blog-variables.scss: -------------------------------------------------------------------------------- 1 | /*fonts*/ 2 | @font-face { 3 | font-family: 'OpenSans'; 4 | src: font_url('OpenSans/OpenSans-Regular-webfont.eot'); 5 | src: font_url('OpenSans/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), 6 | font_url('OpenSans/OpenSans-Regular-webfont.woff') format('woff'), 7 | font_url('OpenSans/OpenSans-Regular-webfont.ttf') format('truetype'), 8 | font_url('OpenSans/OpenSans-Regular-webfont.svg#open_sansbold') format('svg'); 9 | font-weight: 400; 10 | font-style: normal; 11 | } 12 | 13 | @font-face { 14 | font-family: 'OpenSans'; 15 | src: font_url('OpenSans/OpenSans-Bold-webfont.eot'); 16 | src: font_url('OpenSans/OpenSans-Bold-webfont.eot?#iefix') format('embedded-opentype'), 17 | font_url('OpenSans/OpenSans-Bold-webfont.woff') format('woff'), 18 | font_url('OpenSans/OpenSans-Bold-webfont.ttf') format('truetype'), 19 | font_url('OpenSans/OpenSans-Bold-webfont.svg#open_sansbold') format('svg'); 20 | font-weight: 700; 21 | font-style: normal; 22 | } 23 | 24 | $white-smoke: #F5F5F5; 25 | $white: #FFF; 26 | $dark-grey: #3C3C3A; 27 | $grey: #7F7F7F; 28 | $blue: #00978b; 29 | $dark-blue: darken($blue, 10%); 30 | 31 | $bg-color-grey: $white-smoke; 32 | $link-bg-color-hover: $dark-grey; 33 | 34 | // Bootsrap Settings for the `` element. 35 | $body-bg: white !default; 36 | $body-color: $dark-grey; 37 | 38 | // Bootsrap Settings for the link element. 39 | $link-color: $blue; 40 | $link-hover-color: darken($link-color, 25%); 41 | $link-hover-decoration: none !default; 42 | -------------------------------------------------------------------------------- /app/assets/stylesheets/blog.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any styles 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 | * file per style scope. 12 | * 13 | *= require_self 14 | */ 15 | 16 | 17 | /*------------------------------------*\ 18 | #MASTER SCSS 19 | \*------------------------------------*/ 20 | 21 | 22 | @import "blog-variables"; 23 | @import "font-awesome"; 24 | @import "bootstrap"; 25 | 26 | body { 27 | margin-top: 120px; 28 | } 29 | 30 | /* header */ 31 | #blog-header { 32 | background: $bg-color-grey; 33 | } 34 | 35 | #blog-header__home-link { 36 | font-size: 1.8rem; 37 | } 38 | 39 | @include media-breakpoint-down(sm) { 40 | #blog-header__home-link { 41 | font-size: 1.2rem; 42 | } 43 | } 44 | 45 | /* article */ 46 | .blog-content__article { 47 | background-color: $bg-color-grey; 48 | padding: 5px 15px; 49 | } 50 | 51 | .blog-content__article img { 52 | max-width: 100%; 53 | max-height: 100%; 54 | } 55 | 56 | .blog-content__fa { 57 | position: static; 58 | } 59 | -------------------------------------------------------------------------------- /app/assets/stylesheets/blog_posts.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the BlogPosts controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/custom.scss: -------------------------------------------------------------------------------- 1 | body { 2 | margin-top: 120px; 3 | } 4 | 5 | .dl-horizontal dt { 6 | float: left; 7 | width: 165px; 8 | clear: left; 9 | text-align: right; 10 | overflow: hidden; 11 | text-overflow: ellipsis; 12 | white-space: nowrap; 13 | } 14 | 15 | .dl-horizontal dd { 16 | margin-left: 180px; 17 | } 18 | 19 | .dl-horizontal > dd:after { 20 | display: table; 21 | content: ""; 22 | clear: both; 23 | } 24 | 25 | .event__link--more-male { 26 | color: $accent-light; 27 | } 28 | 29 | .event__link--more-female { 30 | color: $accent; 31 | } 32 | 33 | .sorting { 34 | padding: 20px; 35 | margin-bottom: 20px; 36 | border: 1px solid $light-grey; 37 | background-color: $content-background; 38 | 39 | a { 40 | text-decoration: underline; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/assets/stylesheets/header.scss: -------------------------------------------------------------------------------- 1 | #header { 2 | background: $accent; 3 | color: white; 4 | padding: 0px; 5 | 6 | .navbar-brand { 7 | font-family: 'Montserrat Medium'; 8 | &:hover { 9 | color: $very-light-grey; 10 | } 11 | } 12 | .navbar-brand a { 13 | text-transform: uppercase; 14 | padding: 0; 15 | } 16 | 17 | .navbar-brand small { 18 | font-size: 1.3rem; 19 | } 20 | 21 | .navbar-brand img { 22 | max-width: 300px; 23 | } 24 | 25 | a { 26 | color: white; 27 | } 28 | 29 | li.divider { 30 | border-bottom: 0.5px solid $white; 31 | } 32 | 33 | .form-inline.search { 34 | position: relative; 35 | margin-right: 12px; 36 | 37 | input { 38 | padding-right: 40px; 39 | text-overflow: ellipsis; 40 | } 41 | 42 | .btn { 43 | position: absolute; 44 | right: 0; 45 | } 46 | } 47 | 48 | .language-switcher { 49 | margin-left: 6px; 50 | a { 51 | display: inline-block; 52 | padding-left: 6px; 53 | padding-right: 6px; 54 | &.active { 55 | font-weight: bold; 56 | } 57 | } 58 | } 59 | } 60 | 61 | button.navbar-toggler { 62 | background: $very-light-grey; 63 | } 64 | 65 | #btn-top { 66 | display: none; /* Hidden by default */ 67 | color: white; /* Text color */ 68 | cursor: pointer; /* Add a mouse pointer on hover */ 69 | font-size: 35px; /* Increase font size */ 70 | padding-right: 20px; 71 | } 72 | 73 | #btn-top:hover { 74 | color: $dark-grey; /* Add a dark-grey background on hover */ 75 | } 76 | 77 | @include media-breakpoint-down(md) { 78 | .display-3 { 79 | font-size: 3.5rem; 80 | } 81 | } 82 | @include media-breakpoint-down(sm) { 83 | .display-3 { 84 | font-size: 2.5rem; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/assets/stylesheets/variables.scss: -------------------------------------------------------------------------------- 1 | /*fonts*/ 2 | @font-face { 3 | font-family: 'Montserrat'; 4 | src:font-url('Montserrat-Medium.ttf') format('truetype'); 5 | font-weight: 500; 6 | font-style: normal; 7 | } 8 | 9 | @font-face { 10 | font-family: 'Montserrat'; 11 | src:font-url('Montserrat-Bold.ttf') format('truetype'); 12 | font-weight: 700; 13 | font-style: normal; 14 | } 15 | 16 | 17 | @font-face { 18 | font-family: 'OpenSans'; 19 | src: font_url('OpenSans/OpenSans-Regular-webfont.eot'); 20 | src: font_url('OpenSans/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), 21 | font_url('OpenSans/OpenSans-Regular-webfont.woff') format('woff'), 22 | font_url('OpenSans/OpenSans-Regular-webfont.ttf') format('truetype'), 23 | font_url('OpenSans/OpenSans-Regular-webfont.svg#open_sansbold') format('svg'); 24 | font-weight: 400; 25 | font-style: normal; 26 | } 27 | 28 | @font-face { 29 | font-family: 'OpenSans'; 30 | src: font_url('OpenSans/OpenSans-Bold-webfont.eot'); 31 | src: font_url('OpenSans/OpenSans-Bold-webfont.eot?#iefix') format('embedded-opentype'), 32 | font_url('OpenSans/OpenSans-Bold-webfont.woff') format('woff'), 33 | font_url('OpenSans/OpenSans-Bold-webfont.ttf') format('truetype'), 34 | font_url('OpenSans/OpenSans-Bold-webfont.svg#open_sansbold') format('svg'); 35 | font-weight: 700; 36 | font-style: normal; 37 | } 38 | 39 | /* colors */ 40 | $very-light-grey: #f5f5f5; 41 | $light-grey: #DCDCDC; 42 | $grey: #7F7F7F; 43 | $dark-grey: #4E4E4E; 44 | $very-dark-grey: #333333; 45 | 46 | $blue: #375E97; 47 | $dark-blue: darken($blue, 50%); 48 | $red: #c5141c; 49 | $dark-red: #BF3112; 50 | $admin-steel-blue: #4682B4; 51 | 52 | $yellow: #FFBB00; 53 | 54 | $accent: #00978b; 55 | $accent-light: #A1D9D4; 56 | 57 | // Bootsrap Settings for the `` element. 58 | $body-bg: white !default; 59 | $body-color: $dark-grey; 60 | 61 | // Bootsrap Settings for the link element. 62 | $link-color: $grey; 63 | $link-hover-color: darken($link-color, 25%); 64 | 65 | $primary: $dark-grey; 66 | $secondary: $admin-steel-blue; 67 | 68 | // --------------- normal settings 69 | $content-background: $very-light-grey; 70 | $content-shadow: $light-grey; 71 | $content-line: $grey; 72 | 73 | // Units 74 | $border-radius-large: 20px; 75 | -------------------------------------------------------------------------------- /app/controllers/admin/base_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::BaseController < ApplicationController 2 | before_action :authenticate_user 3 | layout 'admin' 4 | # force_ssl if: :use_ssl? 5 | 6 | protected 7 | def authenticate_user 8 | redirect_to log_in_path unless current_user 9 | end 10 | 11 | def use_ssl? 12 | !Rails.env.test? 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/controllers/admin/blog_categories_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::BlogCategoriesController < Admin::BaseController 2 | before_action :set_blog_category, only: [:show, :edit, :update, :destroy] 3 | 4 | 5 | def index 6 | @blog_categories = BlogCategory.order('rank ASC').all 7 | end 8 | 9 | 10 | def show 11 | end 12 | 13 | 14 | def new 15 | @blog_category = BlogCategory.new 16 | build_empty_locales_for_form(@blog_category) 17 | end 18 | 19 | def edit 20 | build_empty_locales_for_form(@blog_category) 21 | end 22 | 23 | def create 24 | @blog_category = BlogCategory.new(blog_category_params) 25 | 26 | if @blog_category.save 27 | redirect_to admin_blog_categories_path, notice: 'Blog category was successfully created.' 28 | else 29 | render :new 30 | end 31 | end 32 | 33 | def update 34 | if @blog_category.update(blog_category_params) 35 | redirect_to admin_blog_categories_path, notice: 'Blog category was successfully updated.' 36 | else 37 | build_empty_locales_for_form(@blog_category) 38 | render :edit 39 | end 40 | end 41 | 42 | def destroy 43 | @blog_category.destroy 44 | redirect_to admin_blog_categories_path, notice: 'Blog category was successfully destroyed.' 45 | end 46 | 47 | private 48 | 49 | def build_empty_locales_for_form(object) 50 | %w(de en).each do |language| 51 | unless object.translated_locales.include?(language.to_sym) 52 | object.translations.build(locale: language.to_sym) 53 | end 54 | end 55 | end 56 | 57 | def set_blog_category 58 | @blog_category = BlogCategory.find(params[:id]) 59 | end 60 | 61 | def blog_category_params 62 | params.require(:blog_category).permit(:slug, 63 | :rank, 64 | translations_attributes: [:id, :name, :locale]) 65 | end 66 | end 67 | -------------------------------------------------------------------------------- /app/controllers/admin/comments_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::CommentsController < Admin::BaseController 2 | 3 | before_action :set_comment, only: [:show, :edit, :update, :destroy, :publish, :hide, :uncheck] 4 | 5 | def index 6 | @commentable = find_commentable 7 | 8 | if @commentable 9 | @comments = @commentable.comments.all.page(params[:page]) 10 | else 11 | 12 | if params[:q].present? 13 | @comments = Comment.search(params[:q]) 14 | else 15 | @comments = Comment.all 16 | end 17 | 18 | case params[:mod_state] 19 | when 'unchecked' 20 | @comments = @comments.unchecked 21 | when 'published' 22 | @comments = @comments.published 23 | when 'hidden' 24 | @comments = @comments.hidden 25 | end 26 | @comments = @comments.includes(:commentable).order(created_at: :desc).page(params[:page]).per(40) 27 | 28 | end 29 | end 30 | 31 | def show 32 | end 33 | 34 | def edit 35 | end 36 | 37 | def update 38 | if @comment.update(comment_params) 39 | redirect_to admin_comment_path(@comment), flash: {success: "Successfully updated comment: \"#{@comment.title}\""} 40 | else 41 | render 'edit' 42 | end 43 | end 44 | 45 | def destroy 46 | @comment.destroy 47 | 48 | respond_to do |format| 49 | format.html { redirect_to admin_comments_path, flash: {success: "Successfully deleted comment: \"#{@comment.title}\" by #{@comment.author}" } } 50 | format.json { head :no_content } 51 | format.js { render layout: false } 52 | end 53 | end 54 | 55 | def publish 56 | @comment.update(mod_state: 'ok') 57 | respond_to do |format| 58 | format.html {redirect_to admin_event_path(@comment), flash: {success: "Successfully published event: \"#{@comment.title}\""}} 59 | format.js {} 60 | end 61 | end 62 | 63 | def hide 64 | @comment.update(mod_state: 'hidden') 65 | respond_to do |format| 66 | format.html {redirect_to admin_event_path(@comment), flash: {success: "Successfully hid event: \"#{@comment.title}\""}} 67 | format.js {} 68 | end 69 | end 70 | 71 | def uncheck 72 | @comment.update(mod_state: nil) 73 | respond_to do |format| 74 | format.html {redirect_to admin_event_path(@comment), flash: {success: "Successfully un-published event: \"#{@comment.title}\""}} 75 | format.js {} 76 | end 77 | end 78 | 79 | 80 | private 81 | 82 | def comment_params 83 | params.require(:comment).permit! 84 | end 85 | 86 | def set_comment 87 | @comment = Comment.find(params[:id]) 88 | end 89 | 90 | def find_commentable 91 | if params[:commentable_type] && params[:commentable_id] 92 | params[:commentable_type].constantize.find(params[:commentable_id].to_i) 93 | end 94 | end 95 | 96 | end 97 | -------------------------------------------------------------------------------- /app/controllers/admin/events_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::EventsController < Admin::BaseController 2 | 3 | before_action :set_event, only: [:show, :edit, :update, :destroy, :publish, :hide, :uncheck] 4 | 5 | def index 6 | if params[:q].present? 7 | @events = Event.search(params[:q]) 8 | else 9 | @events = Event.all 10 | end 11 | 12 | case params[:mod_state] 13 | when 'unchecked' 14 | @events = @events.unchecked 15 | when 'published' 16 | @events = @events.published 17 | when 'hidden' 18 | @events = @events.hidden 19 | end 20 | 21 | case params[:order_by] 22 | when 'created_at' 23 | @events = @events.order(created_at: :desc) 24 | when 'date' 25 | @events = @events.order(date: :desc) 26 | else 27 | @events = @events.order(date: :desc) 28 | end 29 | 30 | @events = @events.includes(:comments).page(params[:page]).per(40) 31 | end 32 | 33 | def update 34 | @event.attributes = event_params 35 | if @event.save(validate: false) 36 | redirect_to admin_event_path(@event), flash: {success: "Successfully updated event: \"#{@event.title}\""} 37 | else 38 | render 'edit' 39 | end 40 | end 41 | 42 | def destroy 43 | @event.destroy 44 | redirect_to admin_events_path, flash: {success: "Successfully deleted event: \"#{@event.title}\""} 45 | end 46 | 47 | def publish 48 | @event.update(mod_state: 'ok') 49 | respond_to do |format| 50 | format.html {redirect_to admin_event_path(@event), flash: {success: "Successfully published event: \"#{@event.title}\""}} 51 | format.js {} 52 | end 53 | end 54 | 55 | def hide 56 | @event.update(mod_state: 'hidden') 57 | respond_to do |format| 58 | format.html {redirect_to admin_event_path(@event), flash: {success: "Successfully hid event: \"#{@event.title}\""}} 59 | format.js {} 60 | end 61 | end 62 | 63 | def uncheck 64 | @event.update(mod_state: nil) 65 | respond_to do |format| 66 | format.html {redirect_to admin_event_path(@event), flash: {success: "Successfully un-published event: \"#{@event.title}\""}} 67 | format.js {} 68 | end 69 | end 70 | 71 | private 72 | def event_params 73 | params.require(:event).permit! 74 | end 75 | 76 | def set_event 77 | @event = Event.find(params[:id]) 78 | end 79 | end 80 | -------------------------------------------------------------------------------- /app/controllers/admin/home_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::HomeController < Admin::BaseController 2 | def start 3 | end 4 | end -------------------------------------------------------------------------------- /app/controllers/admin/images_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::ImagesController < Admin::BaseController 2 | before_action :set_image, only: [:show, :edit, :update, :destroy] 3 | 4 | def index 5 | @images = Image.order(created_at: :desc).all 6 | end 7 | 8 | def show 9 | end 10 | 11 | def new 12 | @image = Image.new 13 | end 14 | 15 | def edit 16 | end 17 | 18 | def create 19 | @image = Image.new(image_params) 20 | 21 | if @image.save 22 | redirect_to admin_images_path, notice: 'Image was successfully created.' 23 | else 24 | render :new 25 | end 26 | end 27 | 28 | def update 29 | if @image.update(image_params) 30 | redirect_to admin_images_path, notice: 'Image was successfully updated.' 31 | else 32 | render :edit 33 | end 34 | end 35 | 36 | def destroy 37 | @image.destroy 38 | redirect_to admin_images_url, notice: 'Image was successfully destroyed.' 39 | end 40 | 41 | private 42 | # Use callbacks to share common setup or constraints between actions. 43 | def set_image 44 | @image = Image.find(params[:id]) 45 | end 46 | 47 | # Only allow a trusted parameter "white list" through. 48 | def image_params 49 | params.require(:image).permit(:name, :description, :file) 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /app/controllers/admin/pages_controller.rb: -------------------------------------------------------------------------------- 1 | class Admin::PagesController < Admin::BaseController 2 | 3 | def index 4 | case params[:page_type] 5 | when 'blog_post' 6 | @pages = Page.blog_posts 7 | when 'blog_page' 8 | @pages = Page.blog_pages 9 | when 'blog_sidebar_snippet' 10 | @pages = Page.blog_sidebar_snippets 11 | when 'sidebar_snippet' 12 | @pages = Page.sidebar_snippets 13 | when 'menu_page' 14 | @pages = Page.menu_pages 15 | else 16 | @pages = Page.all 17 | end 18 | 19 | @pages = @pages.includes(:translations).order(rank: :asc, created_at: :desc) 20 | end 21 | 22 | def show 23 | @page = Page.find(params[:id]) 24 | end 25 | 26 | def new 27 | @page = Page.new 28 | if params[:page_type] == 'blog_post' 29 | @page.page_type = 'blog_post' 30 | @is_new_blog_post = true 31 | end 32 | build_empty_locales_for_form(@page) 33 | end 34 | 35 | def create 36 | @page = Page.new(page_params) 37 | if @page.save 38 | redirect_to admin_pages_path, notice: 'Text was successfully created.' 39 | else 40 | flash[:error] = 'The text could not be saved.' 41 | render :new 42 | end 43 | end 44 | 45 | def edit 46 | @page = Page.find(params[:id]) 47 | build_empty_locales_for_form(@page) 48 | end 49 | 50 | def update 51 | @page = Page.find(params[:id]) 52 | if @page.update(page_params) 53 | redirect_to admin_page_path(@page), notice: 'Text was successfully updated.' 54 | else 55 | flash[:error] = 'The text could not be saved.' 56 | build_empty_locales_for_form(@page) 57 | render :edit 58 | end 59 | end 60 | 61 | def destroy 62 | @page = Page.find(params[:id]) 63 | @page.destroy 64 | redirect_to admin_pages_path, notice: "Page deleted" 65 | end 66 | 67 | 68 | private 69 | 70 | def build_empty_locales_for_form(object) 71 | %w(de en).each do |language| 72 | unless object.translated_locales.include?(language.to_sym) 73 | object.translations.build(locale: language.to_sym) 74 | end 75 | end 76 | end 77 | 78 | def page_params 79 | params.require(:page).permit(:slug, 80 | :page_type, 81 | :rank, 82 | :public, 83 | { blog_category_ids: [] }, 84 | {translations_attributes: [:id, :title, :body, :locale]} 85 | ) 86 | end 87 | end 88 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | 6 | before_action :set_locale 7 | 8 | helper_method :current_user 9 | 10 | def set_locale 11 | I18n.locale = params[:locale] || I18n.default_locale 12 | end 13 | 14 | def default_url_options(options = {}) 15 | if controller_path =~ /^admin\// or controller_name =~ /blog/ 16 | options 17 | else 18 | { locale: I18n.locale }.merge options 19 | end 20 | end 21 | 22 | private 23 | 24 | def current_user 25 | @current_user ||= User.find(session[:user_id]) if session[:user_id] 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /app/controllers/blog_categories_controller.rb: -------------------------------------------------------------------------------- 1 | class BlogCategoriesController < ApplicationController 2 | 3 | layout 'blog' 4 | 5 | def show 6 | @blog_category = BlogCategory.where(slug: params[:slug]).first 7 | if @blog_category 8 | @posts = @blog_category.pages.where(page_type: 'blog_post').order('created_at DESC').all 9 | end 10 | render 'blog_posts/index' 11 | end 12 | end -------------------------------------------------------------------------------- /app/controllers/blog_pages_controller.rb: -------------------------------------------------------------------------------- 1 | class BlogPagesController < ApplicationController 2 | 3 | layout 'blog' 4 | 5 | def show 6 | @page = Page.where(slug: params[:slug]).first 7 | end 8 | end -------------------------------------------------------------------------------- /app/controllers/blog_posts_controller.rb: -------------------------------------------------------------------------------- 1 | class BlogPostsController < ApplicationController 2 | 3 | layout 'blog' 4 | 5 | def index 6 | @posts = Page.blog_posts.is_public.order('created_at DESC').limit(12).all 7 | end 8 | 9 | def show 10 | @post = Page.is_public.find(params[:id]) 11 | end 12 | 13 | def export 14 | respond_to do |format| 15 | @posts = Page.blog_posts.is_public.order('created_at DESC').limit(12).all 16 | @posts_to_export = @posts.map{|post| {title: post.title, 17 | body: post.body, 18 | url: blog_post_url(post), 19 | created_at: post.created_at 20 | }} 21 | format.json { render json: @posts_to_export } 22 | end 23 | end 24 | 25 | end 26 | -------------------------------------------------------------------------------- /app/controllers/comments_controller.rb: -------------------------------------------------------------------------------- 1 | class CommentsController < ApplicationController 2 | 3 | def create 4 | @event = Event.find params[:event_id] 5 | if !@event.published? 6 | redirect_to events_path, notice: 'This event cannot be commented.' 7 | end 8 | @comment = @event.comments.new(comment_params) 9 | 10 | if @comment.save 11 | flash[:success] = 'Ergänzung erfolgreich gespeichert.' 12 | redirect_to event_path(@event) 13 | else 14 | flash[:error] = 'Ihre Ergänzung konnnte nicht gespeichert werden.' 15 | render 'events/show' 16 | end 17 | end 18 | 19 | private 20 | def comment_params 21 | params.require(:comment).permit(:title, 22 | :author, 23 | :body, 24 | :public_contact, 25 | :internal_contact) 26 | end 27 | 28 | end -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/pages_controller.rb: -------------------------------------------------------------------------------- 1 | class PagesController < ApplicationController 2 | def show 3 | @page = Page.where(slug: params[:slug]).first 4 | end 5 | end -------------------------------------------------------------------------------- /app/controllers/sessions_controller.rb: -------------------------------------------------------------------------------- 1 | class SessionsController < ApplicationController 2 | def new 3 | end 4 | 5 | def create 6 | user = User.authenticate(params[:email], params[:password]) 7 | if user 8 | session[:user_id] = user.id 9 | redirect_to admin_root_path, flash: {success: "Logged in!"} 10 | else 11 | flash.now.alert = "Invalid email or password" 12 | render "new" 13 | end 14 | end 15 | 16 | def destroy 17 | session[:user_id] = nil 18 | redirect_to root_url, flash: {success: "Logged out!"} 19 | end 20 | 21 | 22 | # TODO: what is this one used for? Or is it just because "cut&paste" from users conroller 23 | private 24 | # Use callbacks to share common setup or constraints between actions. 25 | def set_session 26 | @session = Session.find(params[:id]) 27 | end 28 | 29 | # Never trust parameters from the scary internet, only allow the white list through. 30 | def user_params 31 | params.require(:user).permit(:email, :password, :password_confirmation) 32 | end 33 | 34 | end 35 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < ApplicationController 2 | 3 | def new 4 | @user = User.new 5 | end 6 | 7 | def create 8 | # TODO: no signup for users, only admins can create users 9 | # @user = User.new(user_params) 10 | # if @user.save 11 | # redirect_to root_url, notice: "Signed up!" 12 | # else 13 | # render "new" 14 | # end 15 | end 16 | 17 | private 18 | # Use callbacks to share common setup or constraints between actions. 19 | def set_user 20 | @user = User.find(params[:id]) 21 | end 22 | 23 | # Never trust parameters from the scary internet, only allow the white list through. 24 | def user_params 25 | params.require(:user).permit(:email, :password, :password_confirmation) 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /app/helpers/admin/comments_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::CommentsHelper 2 | def comments_description 3 | str = "showing #{params[:mod_state] || 'all'} comments" 4 | if params[:q].present? 5 | str += " — search-string: #{params[:q]}" 6 | end 7 | str.html_safe 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/helpers/admin/events_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::EventsHelper 2 | def events_description 3 | str = "showing #{params[:mod_state] || 'all'} events" 4 | if params[:q].present? 5 | str += " — search-string: #{params[:q]}" 6 | end 7 | str.html_safe 8 | end 9 | 10 | def event_mod_state_title(event) 11 | icon = case event.mod_state 12 | when 'ok' then 'thumbs-up' 13 | when 'hidden' then 'thumbs-down' 14 | else 'question-circle' 15 | end 16 | "  mod.-state: #{event.mod_state}".html_safe 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/helpers/admin/pages_helper.rb: -------------------------------------------------------------------------------- 1 | module Admin::PagesHelper 2 | def logo_for_page(page) 3 | icon_name = { 4 | blog_post: 'leaf', 5 | blog_sidebar_snippet: 'align-justify', 6 | blog_page: 'file', 7 | sidebar_snippet: 'align-justify', 8 | menu_page: 'file' 9 | }[page.page_type.to_sym] 10 | return "".html_safe 11 | end 12 | end -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | 3 | def class_for_body_tag 4 | " #{controller_name}-#{action_name}" 5 | end 6 | 7 | def is_blog? 8 | request.subdomains.first == 'blog' 9 | # params[:subdomain] == 'blog' 10 | end 11 | 12 | def bootstrap_class_for(flash_type) 13 | { success: "alert-success", 14 | error: "alert-danger", 15 | alert: "alert-warning", 16 | notice: "alert-info" }[flash_type] || flash_type.to_s 17 | end 18 | 19 | def flash_messages(opts = {}) 20 | flash.each do |msg_type, message| 21 | concat(content_tag(:div, class: "alert #{bootstrap_class_for(msg_type.to_sym)} fade show") do 22 | concat content_tag(:button, 'x', class: "close", data: { dismiss: 'alert' }) 23 | concat raw(message) 24 | end) 25 | end 26 | nil 27 | end 28 | 29 | def layout_needs_sidebar? 30 | %w(events pages blog_posts blog_pages blog_categories).include?(params[:controller]) and %w(index show).include?(params[:action]) 31 | end 32 | 33 | def language_switcher 34 | target_url = request.original_url 35 | if request.fullpath == '/' 36 | target_url += "#{I18n.locale.to_s}/" 37 | end 38 | links = [:de, :en].map do |lang| 39 | if lang == I18n.locale 40 | link_to(lang.to_s, target_url, class: 'nav-link active') 41 | else 42 | link_to(lang.to_s, target_url.sub(/\/(de|en)\//,"/#{lang.to_s}/")) 43 | end 44 | end 45 | links.join('·') 46 | end 47 | 48 | def markdown(text, options={}) 49 | render_options = { 50 | safe_links_only: true, 51 | hard_wrap: true 52 | }.merge(options) 53 | 54 | extensions = { 55 | autolink: true, 56 | # superscript: true, 57 | # disable_indented_code_blocks: true 58 | } 59 | 60 | renderer = Redcarpet::Render::HTML.new(render_options) 61 | markdown = Redcarpet::Markdown.new(renderer, extensions) 62 | 63 | markdown.render(text).html_safe 64 | end 65 | end 66 | -------------------------------------------------------------------------------- /app/helpers/blog_categories_helper.rb: -------------------------------------------------------------------------------- 1 | module BlogCategoriesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/blog_posts_helper.rb: -------------------------------------------------------------------------------- 1 | module BlogPostsHelper 2 | def extract_first_image_path(post) 3 | caption, image_path = post.body.match(/\[([^\[\]]+)\]\(([^)]+)/).try(:captures) 4 | 5 | if image_path.present? 6 | URI.join(request.base_url, image_path) 7 | else 8 | URI.join(request.base_url, 'marie-curie-speakerinnen.jpg') 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/helpers/events_helper.rb: -------------------------------------------------------------------------------- 1 | module EventsHelper 2 | include ActsAsTaggableOn::TagsHelper 3 | 4 | def is_single_view 5 | action_name == 'show' 6 | end 7 | 8 | def linked_contact_info(contact_info) 9 | 10 | case contact_info 11 | when /^@/ 12 | link_to(contact_info, "https://twitter.com/#{contact_info.gsub(/@/,'')}") 13 | when /^http/ 14 | link_to(' Link'.html_safe, contact_info) 15 | when /.+@.+/ 16 | contact_info.sub(/@/, '(-ät-)') 17 | else 18 | contact_info 19 | end 20 | 21 | end 22 | 23 | def classname_for_event_title(event) 24 | event.percent_female >= 50 ? 'more-female' : 'more-male' 25 | end 26 | 27 | end 28 | 29 | -------------------------------------------------------------------------------- /app/helpers/sessions_helper.rb: -------------------------------------------------------------------------------- 1 | module SessionsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/users_helper.rb: -------------------------------------------------------------------------------- 1 | module UsersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/mailers/.keep -------------------------------------------------------------------------------- /app/mailers/notifications_mailer.rb: -------------------------------------------------------------------------------- 1 | class NotificationsMailer < ActionMailer::Base 2 | default from: 'admina@speakerinnen.org' 3 | 4 | def new_event(event) 5 | @event = event 6 | @url = 'https://50prozent.speakerinnen.org/log_in' 7 | mail(to: 'admina@speakerinnen.org, anne@speakerinnen.org', subject: 'New Event in 50 percent') 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/models/.keep -------------------------------------------------------------------------------- /app/models/article.rb: -------------------------------------------------------------------------------- 1 | class Article 2 | 3 | attr_accessor :title, 4 | :pubDate, 5 | :dc_creator, 6 | :excerpt_encoded, 7 | :content_encoded, 8 | :tags, 9 | :post_type, 10 | :wp_status 11 | 12 | def created_at 13 | Time.parse(@pubDate) 14 | end 15 | 16 | def unwanted? 17 | created_at.year == -1 or post_type != 'post' 18 | end 19 | 20 | end -------------------------------------------------------------------------------- /app/models/blog_category.rb: -------------------------------------------------------------------------------- 1 | class BlogCategory < ActiveRecord::Base 2 | 3 | translates :name, :fallbacks_for_empty_translations => true 4 | 5 | has_and_belongs_to_many :pages 6 | 7 | accepts_nested_attributes_for :translations 8 | 9 | validates :slug, format: { with: /\A[a-z0-9_]+\z/, message: "only allows letters, numbers and underscore" } 10 | validates :slug, :rank, presence: true 11 | validates :slug, :rank, uniqueness: true 12 | validates :rank, :numericality => { greater_than: 0} 13 | end 14 | -------------------------------------------------------------------------------- /app/models/comment.rb: -------------------------------------------------------------------------------- 1 | class Comment < ActiveRecord::Base 2 | 3 | belongs_to :commentable, polymorphic: true 4 | validates :title, :author, :body, presence: true 5 | 6 | scope :unchecked, -> { where('comments.mod_state IS NULL') } 7 | scope :published, -> { where( mod_state: 'ok') } 8 | scope :hidden, -> { where( mod_state: 'hidden') } 9 | 10 | def self.search(q) 11 | q.strip! 12 | Comment.where('comments.title ILIKE ? OR comments.body ILIKE ? OR comments.author ILIKE ?', 13 | "%#{q}%", "%#{q}%", "%#{q}%") 14 | end 15 | 16 | 17 | def unchecked? 18 | mod_state == nil 19 | end 20 | 21 | def published? 22 | mod_state == 'ok' 23 | end 24 | 25 | def hidden? 26 | mod_state == 'hidden' 27 | end 28 | 29 | end 30 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/event.rb: -------------------------------------------------------------------------------- 1 | class Event < ActiveRecord::Base 2 | 3 | has_many :comments, as: :commentable, dependent: :destroy 4 | 5 | EDIT_TIME = 20 # minutes the event stays editable by the author 6 | 7 | validates :title, :date, :city, :country_code, :main_url, :total, :woman, presence: true 8 | validates :total, :woman, numericality: { only_integer: true, greater_than_or_equal_to: 0 } 9 | 10 | acts_as_taggable 11 | acts_as_taggable_on :topics 12 | 13 | scope :unchecked, -> { where('events.mod_state IS NULL') } 14 | scope :published, -> { where( mod_state: 'ok') } 15 | scope :hidden, -> { where( mod_state: 'hidden') } 16 | scope :counted, -> { where('events.total IS NOT NULL') } 17 | 18 | def self.search(q) 19 | q.strip! 20 | Event.where('events.title ILIKE ? OR events.subtitle ILIKE ? OR events.description ILIKE ? OR events.reporter ILIKE ? OR events.city ILIKE ?', 21 | "%#{q}%", "%#{q}%", "%#{q}%", "%#{q}%", "%#{q}%") 22 | end 23 | 24 | def percent_male 25 | 100 - (woman.to_f/total.to_f*100).to_i 26 | end 27 | 28 | def percent_female 29 | (woman.to_f/total.to_f*100).to_i 30 | end 31 | 32 | def country_name 33 | country = ISO3166::Country[country_code] 34 | if country 35 | country.translations[I18n.locale.to_s] || country.name 36 | else 37 | '' 38 | end 39 | end 40 | 41 | def unchecked? 42 | mod_state == nil 43 | end 44 | 45 | def published? 46 | mod_state == 'ok' 47 | end 48 | 49 | def hidden? 50 | mod_state == 'hidden' 51 | end 52 | 53 | def recently_created? 54 | remaining_edit_time > 0 55 | end 56 | 57 | def remaining_edit_time 58 | created_at - EDIT_TIME.minutes.ago 59 | end 60 | 61 | def frontend_editable?(reported_events_ids) 62 | reported_events_ids.to_a.include?(id) && recently_created? 63 | end 64 | 65 | def has_all_the_numbers? 66 | woman.is_a?(Integer) and total.is_a?(Integer) 67 | end 68 | 69 | def self.to_csv(options = {}) 70 | CSV.generate(options) do |csv| 71 | csv << permitted_columns 72 | all.each do |event| 73 | csv << event.attributes.values_at(*permitted_columns) 74 | end 75 | end 76 | end 77 | 78 | def self.permitted_columns 79 | ["title", "date", "city", "country_code", "main_url", "woman", "total" ] 80 | end 81 | 82 | def as_json(options={}) 83 | super(:only => [ :date, :title, :city, :country_code, :woman, :total, :main_url ] 84 | ) 85 | end 86 | end 87 | -------------------------------------------------------------------------------- /app/models/image.rb: -------------------------------------------------------------------------------- 1 | class Image < ActiveRecord::Base 2 | mount_uploader :file, FileUploader 3 | 4 | end 5 | -------------------------------------------------------------------------------- /app/models/page.rb: -------------------------------------------------------------------------------- 1 | class Page < ActiveRecord::Base 2 | 3 | translates :title, :body, :fallbacks_for_empty_translations => true 4 | 5 | has_and_belongs_to_many :blog_categories 6 | 7 | accepts_nested_attributes_for :translations 8 | 9 | validates :slug, format: { with: /\A[a-z0-9_]+\z/, message: "only allows letters, numbers and underscore" } 10 | validates :slug, :page_type, presence: true 11 | validates :slug, uniqueness: true 12 | validates :rank, presence: true, if: Proc.new {|page| %w(sidebar_snippet menu_page blog_page blog_sidebar_snippet).include?(page.page_type)} 13 | validates :rank, uniqueness: {scope: 'page_type'}, allow_nil: true 14 | 15 | scope :blog_posts, -> { where( page_type: 'blog_post') } 16 | scope :is_public, -> { where( public: true ) } 17 | scope :blog_pages, -> { where( page_type: 'blog_page') } 18 | scope :blog_sidebar_snippets, -> { where( page_type: 'blog_sidebar_snippet') } 19 | scope :sidebar_snippets, -> { where( page_type: 'sidebar_snippet') } 20 | scope :menu_pages, -> { where( page_type: 'menu_page') } 21 | 22 | def abstract 23 | body_str = translation_for(I18n.locale).body 24 | match_data = /\[\-\-\-\]/.match(body_str) 25 | match_data ? match_data.pre_match : nil 26 | end 27 | 28 | def main_body 29 | body_str = translation_for(I18n.locale).body 30 | match_data = /\[\-\-\-\]/.match(body_str) 31 | match_data ? match_data.post_match : body_str 32 | end 33 | 34 | def full_body 35 | body_str = translation_for(I18n.locale).body 36 | body_str.gsub(/\[\-\-\-\]/, "\n") 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ActiveRecord::Base 2 | attr_accessor :password 3 | before_save :encrypt_password 4 | 5 | validates :password, confirmation: true 6 | validates :password, presence: true 7 | validates :email, presence: true 8 | validates :email, uniqueness: true 9 | 10 | def self.authenticate(email, password) 11 | user = find_by_email(email) 12 | if user && user.password_hash == BCrypt::Engine.hash_secret(password, user.password_salt) 13 | user 14 | else 15 | nil 16 | end 17 | end 18 | 19 | def encrypt_password 20 | if password.present? 21 | self.password_salt = BCrypt::Engine.generate_salt 22 | self.password_hash = BCrypt::Engine.hash_secret(password, password_salt) 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /app/uploaders/file_uploader.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | # http://stackoverflow.com/questions/9043662/carrierwave-files-with-capistrano 4 | 5 | class FileUploader < CarrierWave::Uploader::Base 6 | 7 | # Include RMagick or MiniMagick support: 8 | # include CarrierWave::RMagick 9 | # include CarrierWave::MiniMagick 10 | 11 | # Choose what kind of storage to use for this uploader: 12 | storage :file 13 | after :remove, :delete_empty_upstream_dirs 14 | # storage :fog 15 | 16 | # Override the directory where uploaded files will be stored. 17 | # This is a sensible default for uploaders that are meant to be mounted: 18 | def store_dir 19 | # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" 20 | "images/#{model.id}" 21 | end 22 | 23 | # Provide a default URL as a default if there hasn't been a file uploaded: 24 | # def default_url 25 | # # For Rails 3.1+ asset pipeline compatibility: 26 | # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) 27 | # 28 | # "/images/fallback/" + [version_name, "default.png"].compact.join('_') 29 | # end 30 | 31 | # Process files as they are uploaded: 32 | # process :scale => [200, 300] 33 | # 34 | # def scale(width, height) 35 | # # do something 36 | # end 37 | 38 | # Create different versions of your uploaded files: 39 | # version :thumb do 40 | # process :resize_to_fit => [50, 50] 41 | # end 42 | 43 | # Add a white list of extensions which are allowed to be uploaded. 44 | # For images you might use something like this: 45 | # def extension_white_list 46 | # %w(jpg jpeg gif png) 47 | # end 48 | 49 | # Override the filename of the uploaded files: 50 | # Avoid using model.id or version_name here, see uploader/store.rb for details. 51 | # def filename 52 | # "something.jpg" if original_filename 53 | # end 54 | 55 | def store_dir 56 | "images/#{model.id}" 57 | end 58 | 59 | def delete_empty_upstream_dirs 60 | path = ::File.expand_path(store_dir, root) 61 | Dir.delete(path) # fails if path not empty dir 62 | rescue SystemCallError 63 | true # nothing, the dir is not empty 64 | end 65 | 66 | end 67 | -------------------------------------------------------------------------------- /app/views/admin/blog_categories/_blog_category.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= link_to admin_blog_category_path(blog_category) do %> 4 | 5 |   6 | <%= blog_category.slug %> 7 | <% end %> 8 | 9 | <%= blog_category.rank %> 10 | <% [:de, :en].each do |locale| %> 11 | 12 | <%= image_tag("flags/#{locale.to_s}.png") %> 13 | <%= blog_category.translation_for(locale).name %> 14 | 15 | <% end %> 16 | 17 | <%= link_to edit_admin_blog_category_path(blog_category) do %> 18 | edit 19 | <% end %> 20 | 21 | -------------------------------------------------------------------------------- /app/views/admin/blog_categories/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= bootstrap_form_for([:admin, @blog_category], layout: :horizontal, html: {class: 'my-3'}) do |f| %> 2 | 3 | <% if @blog_category.errors.any? %> 4 |
5 |

<%= pluralize(@blog_category.errors.count, "error") %> prohibited this blog_category from being saved:

6 | 7 | 12 |
13 | <% end %> 14 | 15 | <%= f.text_field :slug, label: 'Slug', 16 | help: 'uniq identifyer, part of URL, only: a-z0-9_', 17 | control_col: "col-sm-4" %> 18 | 19 | <%= f.fields_for :translations, f.object.translations.sort_by(&:locale) do |translation| %> 20 |

21 | <%= image_tag "flags/#{translation.object.locale.to_s}.png" %> 22 | <%= translation.object.locale.to_s.upcase %> 23 |

24 | <%= translation.hidden_field :locale %> 25 | <%= translation.text_field :name %> 26 |
27 | <% end %> 28 | 29 | <%= f.text_field :rank, { label: "Sort rank", 30 | help: 'Order to sort elements in menu or sidebar', 31 | control_col: "col-sm-2"} %> 32 | 33 | <%= f.submit 'Save', class: "btn btn-secondary" %> 34 | 35 | <% end %> 36 | -------------------------------------------------------------------------------- /app/views/admin/blog_categories/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Editing Blog Category: <%= @blog_category.slug %>

2 | 3 | <%= render 'form' %> 4 | 5 | 6 | <%= link_to 'Back', admin_blog_categories_path %> 7 | -------------------------------------------------------------------------------- /app/views/admin/blog_categories/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Blog Categories:

4 |
5 |
6 | <%= link_to new_admin_blog_category_path, class: 'btn btn-secondary' do %> 7 | 8 | add a category 9 | <% end %> 10 |
11 |
12 | 13 | 14 | <%= render @blog_categories %> 15 |
16 | -------------------------------------------------------------------------------- /app/views/admin/blog_categories/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

New Blog Category

3 | 4 | <%= render 'form' %> 5 | 6 |
7 | -------------------------------------------------------------------------------- /app/views/admin/blog_categories/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

3 | 4 | Blog Category: <%= @blog_category.slug %> 5 |
6 |

7 |
8 | <%= link_to edit_admin_blog_category_path(@blog_category), class: 'btn btn-success' do %> 9 | 10 | edit 11 | <% end %> 12 |   13 | <%= link_to admin_blog_categories_path, class: 'btn btn-primary' do %> 14 | 15 | back to list 16 | <% end %> 17 | <%= link_to admin_blog_category_path(@blog_category), method: 'delete', data: {confirm: 'Are you sure? There is no UNDO!'}, class: 'btn btn-danger' do %> 18 | 19 | delete 20 | <% end %> 21 |
22 |
23 | 24 |
25 |
Slug
26 |
<%= @blog_category.slug %>
27 |
Sort Rank
28 |
<%= @blog_category.rank %>
29 |
 
 
30 |
Created
31 |
<%= @blog_category.created_at.to_s(:gdt) %>
32 |
Last Update
33 |
<%= @blog_category.updated_at.to_s(:gdt) %>
34 | <% [:de, :en].each do |locale| %> 35 |
 
 
36 |
<%= image_tag("flags/#{locale.to_s}.png") %>
37 |
<%= locale %>
38 |
Name
39 |
<%= @blog_category.translation_for(locale).name %>
40 | <% end %> 41 |
-------------------------------------------------------------------------------- /app/views/admin/comments/_comment.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= link_to comment.title, admin_comment_path(comment) %> 5 | 6 |
7 | <% if comment.commentable %> 8 | <%= link_to polymorphic_path([:admin, comment.commentable]), class: 'commentable' do %> 9 | 10 | 11 | <%= comment.commentable_type %>: 12 | 13 | <%= comment.commentable.title %> 14 | <% end %> 15 | <% else %> 16 | - 17 | <% end %> 18 |
19 |
20 | 24 | 50 |
51 | 52 | 53 | 54 | <%= comment.author %>
55 |
56 | 57 |
58 | <%= comment.created_at.to_s(:gdt) %> 59 | 60 | 61 | <%= simple_format(comment.body) %> 62 | 63 | 64 | <%= link_to admin_comment_path(comment), method: :delete, remote: true, class: 'btn btn-danger pull-right delete_comment' do %> 65 | 66 | <% end %> 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /app/views/admin/comments/_filter_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_tag(admin_comments_path, method: 'get', class: 'form-inline row', id: 'filter-form', role: 'form') do %> 2 |
3 | 4 |
5 | 9 | 14 | 19 | 24 |
25 | 26 |
27 | <%= text_field_tag(:q, params[:q], {class: 'form-control', placeholder: 'Suchbegriff..'}) %> 28 | <%= submit_tag(raw('Filter'), class: 'btn btn-secondary') %> 29 |
30 |
31 | 32 | <% end %> 33 | -------------------------------------------------------------------------------- /app/views/admin/comments/destroy.js.erb: -------------------------------------------------------------------------------- 1 | $('.delete_comment').bind('ajax:success', function() { 2 | $(this).closest('tr').find('td').css("background-color", "darkgrey"); 3 | $(this).closest('td').find('a').removeClass("btn-danger").attr('disabled', true); 4 | }); 5 | -------------------------------------------------------------------------------- /app/views/admin/comments/edit.html.erb: -------------------------------------------------------------------------------- 1 | <%= bootstrap_form_for([:admin, @comment]) do |f| %> 2 | 3 |
4 | Comment 5 | <%= f.text_field :title %> 6 | <%= f.text_field :author %> 7 | <%= f.text_area :body %> 8 |
9 | 10 |
11 | Contact 12 | <%= f.text_field :public_contact %> 13 | <%= f.text_field :internal_contact %> 14 |
15 | 16 | <%= f.submit 'Safe', class: "btn btn-secondary" %> 17 | <% end %> 18 | 19 | <%= link_to admin_comment_path(@comment), class: 'btn btn-secondary pull-right' do %> 20 | 21 | Cancel / Back 22 | <% end %> 23 | -------------------------------------------------------------------------------- /app/views/admin/comments/hide.js.erb: -------------------------------------------------------------------------------- 1 | $("#<%= dom_id(@comment) %>").replaceWith("<%= escape_javascript(render @comment) %>"); -------------------------------------------------------------------------------- /app/views/admin/comments/index.html.erb: -------------------------------------------------------------------------------- 1 | <%= render partial: 'filter_form' %> 2 | 3 |
4 |

5 | 6 | <%= comments_description %> 7 |

8 | 9 |

10 | <%= page_entries_info @comments %> 11 |

12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | <%= render @comments %> 24 |
TitleAuthorBody
25 | 26 | <% if @comments.any? %> 27 |
28 |
29 | <%= page_entries_info @comments %> 30 |
31 |
32 | <%= paginate @comments %> 33 |
34 |
35 | <% end %> 36 | 37 | 42 | -------------------------------------------------------------------------------- /app/views/admin/comments/publish.js.erb: -------------------------------------------------------------------------------- 1 | $("#<%= dom_id(@comment) %>").replaceWith("<%= escape_javascript(render @comment) %>"); -------------------------------------------------------------------------------- /app/views/admin/comments/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= link_to admin_comments_path, class: 'btn btn-secondary' do %> 3 | 4 | Back to list of comments 5 | <% end %> 6 | 7 | <%= link_to edit_admin_comment_path(@comment), class: 'btn btn-secondary' do %> 8 | 9 | Edit this comment 10 | <% end %> 11 | 12 | <%= link_to admin_comment_path(@comment), method: 'delete', class: 'btn btn-danger pull-right' do %> 13 | 14 | Delete this comment 15 | <% end %> 16 | 17 |

18 | 19 | <%= @comment.title %> 20 | id: <%= @comment.id %> 21 |

22 | 23 |
24 |
Title
25 |
<%= @comment.title %>
26 |
Author
27 |
<%= @comment.author %>
28 |
Body
29 |
<%= @comment.body %>
30 |
 
 
31 |
Public_contact
32 |
<%= @comment.public_contact %>
33 |
Internal_contact
34 |
<%= @comment.internal_contact %>
35 |
 
 
36 |
Created_at
37 |
<%= @comment.created_at.to_s(:gdt) %>
38 |
Updated_at
39 |
<%= @comment.updated_at.to_s(:gdt) %>
40 |
Mod_state
41 |
<%= @comment.mod_state %>
42 |
 
 
43 |
Belongs to <%= @comment.commentable_type %>
44 |
<%= link_to @comment.commentable.title, polymorphic_path([:admin, @comment.commentable]) %>
45 |
46 | 47 |
48 | -------------------------------------------------------------------------------- /app/views/admin/comments/uncheck.js.erb: -------------------------------------------------------------------------------- 1 | $("#<%= dom_id(@comment) %>").replaceWith("<%= escape_javascript(render @comment) %>"); -------------------------------------------------------------------------------- /app/views/admin/events/_event.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <% if event.recently_created? %> 4 |   5 | 6 | <% end %> 7 | <%= link_to event.title, admin_event_path(event) %> 8 | 9 | 10 | <%= event.date.to_s(:gd) if event.date %> 11 | 12 | 13 | <%= event.city %> 14 | 15 | 16 | 48 | 49 | 50 | <%= event.created_at.to_s(:gdt) %> 51 | <%= "von: #{event.reporter}" if event.reporter.present? %> 52 | 53 | 54 | <% if event.comments.any? %> 55 | <%= link_to admin_comments_path(commentable_type: 'Event', commentable_id: event.id) do %> 56 | 57 | <%= event.comments.size %> 58 | <% end %> 59 | <% end %> 60 | 61 | 62 | <% if event.internal_admin_info.present? || event.internal_user_info.present? %> 63 | 70 | 71 | 72 | <% end %> 73 | <%= link_to edit_admin_event_path(event) do %> 74 | 75 | <% end %> 76 | 77 | 78 | -------------------------------------------------------------------------------- /app/views/admin/events/_filter_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_tag(admin_events_path, method: 'get', class: 'form-inline row', id: 'filter-form', role: 'form') do %> 2 | 3 |
4 | 5 |
6 | 10 | 14 |
15 | 16 |
17 | 21 | 26 | 31 | 36 |
37 |
38 | <%= text_field_tag(:q, params[:q], {class: 'form-control', placeholder: 'Suchbegriff..'}) %> 39 | <%= submit_tag(raw('Filter'), class: 'btn btn-secondary') %> 40 |
41 |
42 | 43 | 44 | <% end %> 45 | -------------------------------------------------------------------------------- /app/views/admin/events/edit.html.erb: -------------------------------------------------------------------------------- 1 | <%= bootstrap_form_for([:admin, @event]) do |f| %> 2 | 3 | <% if f.object.body.present? %> 4 |
5 | Body (Text aus dem alten Wordpress Blog - HTML) 6 | <%= f.text_area :body %> 7 | Body (Text aus dem alten Wordpress Blog - Text) 8 | <%= simple_format(@event.body) %> 9 |
10 | <% end %> 11 | 12 | <%= render partial: 'events/form_fields', locals: {f: f} %> 13 | 14 |
15 | Moderation Intern 16 | <%= f.text_area :internal_admin_info %> 17 |
18 | 19 | <%= f.submit 'Speichern', class: "btn btn-success mb-5" %> 20 | <% end %> 21 | -------------------------------------------------------------------------------- /app/views/admin/events/hide.js.erb: -------------------------------------------------------------------------------- 1 | $("#<%= dom_id(@event) %>").replaceWith("<%= escape_javascript(render @event) %>"); -------------------------------------------------------------------------------- /app/views/admin/events/index.html.erb: -------------------------------------------------------------------------------- 1 | <%= render partial: 'filter_form' %> 2 | 3 |
4 |

5 | 6 | <%= events_description %> 7 |

8 | 9 |

10 | <%= page_entries_info @events %> 11 |

12 |
13 | 14 | 15 | <%= render @events %> 16 |
17 | 18 | <% if @events.any? %> 19 |
20 |
21 | <%= page_entries_info @events %> 22 |
23 |
24 | <%= paginate @events %> 25 |
26 |
27 | <% end %> 28 | 29 | 47 | -------------------------------------------------------------------------------- /app/views/admin/events/publish.js.erb: -------------------------------------------------------------------------------- 1 | $("#<%= dom_id(@event) %>").replaceWith("<%= escape_javascript(render @event) %>"); -------------------------------------------------------------------------------- /app/views/admin/events/uncheck.js.erb: -------------------------------------------------------------------------------- 1 | $("#<%= dom_id(@event) %>").replaceWith("<%= escape_javascript(render @event) %>"); -------------------------------------------------------------------------------- /app/views/admin/images/_form.html.erb: -------------------------------------------------------------------------------- 1 |

2 | Images should be no wider than 700px to fit nicely into the layout. 3 |

4 | <%= bootstrap_form_for(['admin', @image]) do |f| %> 5 | 6 | <% if @image.errors.any? %> 7 |
8 |

<%= pluralize(@image.errors.count, "error") %> prohibited this image from being saved:

9 | 10 | 15 |
16 | <% end %> 17 | 18 | <%= f.text_field :name, help: 'helps you to find the image later, maybe include the name of the article or event the image belongs to' %> 19 | <%= f.text_area :description, help: 'optional, leave some background information here. what is the source of the picture? are there any copyright or licence informations?' %> 20 | <%= f.file_field :file, help: 'Your current file-name will become part of the URL later. So maybe rename the image-file on your machine?' %> 21 | <%= f.submit 'Save', class: "btn btn-secondary" %> 22 | 23 | <% end %> 24 | -------------------------------------------------------------------------------- /app/views/admin/images/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Editing Image

3 | 4 | <%= render 'form' %> 5 | 6 |
7 | -------------------------------------------------------------------------------- /app/views/admin/images/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Images:

5 |
6 |
7 | <%= link_to new_admin_image_path, class: 'btn btn-secondary' do %> 8 | 9 | add a image 10 | <% end %> 11 |
12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | <% @images.each do |image| %> 26 | 27 | 32 | 33 | 34 | 35 | 41 | 47 | 48 | <% end %> 49 | 50 |
ImgNameFile
28 | <%= link_to admin_image_path(image) do %> 29 | <%= image_tag image.file_url if image.file? %> 30 | <% end %> 31 | <%= link_to image.name, admin_image_path(image) %><%= image.file %> 36 | <%= link_to edit_admin_image_path(image) do %> 37 | 38 | edit 39 | <% end %> 40 | 42 | <%= link_to admin_image_path(image), method: :delete, data: { confirm: 'Are you sure?' } do %> 43 | 44 | destroy 45 | <% end %> 46 |
51 | 52 |
53 |
54 | -------------------------------------------------------------------------------- /app/views/admin/images/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

New Image

3 | 4 | <%= render 'form' %> 5 |
6 | -------------------------------------------------------------------------------- /app/views/admin/images/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 | 5 | Image: 6 |
7 |

8 |
9 | <%= link_to edit_admin_image_path(@image), class: 'btn btn-secondary' do %> 10 | 11 | edit 12 | <% end %> 13 |   14 | <%= link_to admin_images_path, class: 'btn btn-secondary' do %> 15 | 16 | back to list 17 | <% end %> 18 | <%= link_to admin_image_path(@image), method: 'delete', data: {confirm: 'Are you sure? There is no UNDO!'}, class: 'btn btn-danger' do %> 19 | 20 | delete 21 | <% end %> 22 |
23 |
24 | 25 |
26 |

27 | Name:
28 | <%= @image.name %> 29 |

30 | 31 |

32 | Description:
33 | <%= @image.description %> 34 |

35 | 36 |

37 | URL:
38 | <%= "http://blog.speakerinnen.org#{@image.file_url}" %> 39 |

40 | 41 |

42 | HTML-Image-Tag:
43 | <%= text_field_tag('html', "\"img", style: 'width: 760px') %> 44 |

45 | 46 |

47 | markdown-Image-Tag:
48 | <%= text_field_tag('html', "![alt img desc](//blog.speakerinnen.org#{@image.file_url})", style: 'width: 760px') %> 49 |

50 | 51 |

52 | File:
53 | <%= image_tag @image.file_url %> 54 |

55 | 56 |
57 | -------------------------------------------------------------------------------- /app/views/admin/pages/_form_fields.html.erb: -------------------------------------------------------------------------------- 1 | <% if f.object.page_type == 'blog_post' %> 2 |
3 | 6 |
7 | <%= f.check_box :public %> 8 |
9 |
10 | <% end %> 11 | 12 | <%= f.text_field :slug, label: 'Slug', 13 | help: 'uniq identifyer, part of URL, only: a-z0-9_', 14 | control_col: "col-sm-4" %> 15 |
16 | <%= f.form_group :page_type, label: { text: "Text-Type" }, help: "Where and how to display the text?" do %> 17 | <%= f.radio_button :page_type, "blog_post", label: "Blog Post", inline: true %> 18 | <%= f.radio_button :page_type, "blog_page", label: "Blog Page", inline: true %> 19 | <%= f.radio_button :page_type, "blog_sidebar_snippet", label: "Blog Sidebar Snippet", inline: true %> 20 | <%= f.radio_button :page_type, "sidebar_snippet", label: "Sidebar Snippet", inline: true %> 21 | <%= f.radio_button :page_type, "menu_page", label: "Menu Page", inline: true %> 22 | <%= f.radio_button :page_type, "other", label: "Other", inline: true %> 23 | <% end %> 24 | 25 | <%= f.text_field :rank, { label: "Sort rank", 26 | help: 'Order to sort elements in menu or sidebar', 27 | control_col: "col-sm-2"} %> 28 |
29 | 32 |
33 | existing ranks:   34 | sidebar_snippets: <%= Page.sidebar_snippets.pluck(:rank).sort.join(', ') %>   -   35 | menu_pages: <%= Page.menu_pages.pluck(:rank).sort.join(', ') %> 36 |
37 |
38 |
39 | 40 | <% if f.object.page_type == 'blog_post' %> 41 | <%= f.collection_check_boxes :blog_category_ids, BlogCategory.order(:rank).all, :id, :name, inline: true %> 42 | <% end %> 43 |
44 | <%= f.fields_for :translations, f.object.translations.sort_by(&:locale) do |translation| %> 45 |

46 | <%= image_tag "flags/#{translation.object.locale.to_s}.png" %> 47 | <%= translation.object.locale.to_s.upcase %> 48 |

49 | <%= translation.hidden_field :locale %> 50 | <%= translation.text_field :title %> 51 | <%= translation.text_area :body, help: (I18n.t 'new.blog_post.body_help').html_safe %> 52 |
53 | <% end %> 54 | -------------------------------------------------------------------------------- /app/views/admin/pages/_page.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= link_to admin_page_path(page) do %> 4 | <%= logo_for_page(page) %> 5 |   6 | <%= page.slug %> 7 | <% end %> 8 | 9 | 10 | <% if page.blog_categories.any? %> 11 | " 13 | > 14 | <% else %> 15 |   16 | <% end %> 17 | 18 | <%= page.rank %> 19 | <% [:de, :en].each do |locale| %> 20 | 21 | <%= image_tag("flags/#{locale.to_s}.png") %> 22 | <%= page.translation_for(locale).title %> 23 | 24 | <% end %> 25 | 26 | <%= page.created_at.to_s(:gdt) %> 27 | 28 | 29 | <% if page.public %> 30 | 31 | <% end %> 32 | 33 | 34 | <%= link_to edit_admin_page_path(page) do %> 35 | edit 36 | <% end %> 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/views/admin/pages/edit.html.erb: -------------------------------------------------------------------------------- 1 | <%= bootstrap_form_for([:admin, @page], layout: :horizontal, html: {class: 'page-form'}) do |f| %> 2 | <%= render partial: 'form_fields', locals: {f: f} %> 3 |
4 |
5 | 11 |
12 |
13 | <%= f.submit 'Update', class: "btn btn-success" %> 14 |
15 |
16 | <% end %> -------------------------------------------------------------------------------- /app/views/admin/pages/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

<%= params[:page_type] ? params[:page_type].humanize.pluralize : 'All pages and posts' %>

4 |
5 |
6 | 56 |
57 |
58 | <%= link_to new_admin_page_path(page_type: 'blog_post'), class: 'btn btn-secondary' do %> 59 | 60 | add new blog post 61 | <% end %> 62 |   63 | <%= link_to new_admin_page_path, class: 'btn btn-secondary' do %> 64 | 65 | add new page/snippet 66 | <% end %> 67 |
68 |
69 | 70 | 71 | <%= render @pages %> 72 |
73 | -------------------------------------------------------------------------------- /app/views/admin/pages/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <% if @is_new_blog_post %> 3 |

Write new blog post:

4 | <% else %> 5 |

Write new page or snippet:

6 | <% end %> 7 | 8 | <%= bootstrap_form_for([:admin, @page], layout: :horizontal, html: {class: 'pt-3 page-form form-horizontal'}) do |f| %> 9 | <%= render partial: 'form_fields', locals: {f: f} %> 10 |
11 |
12 | 18 |
19 |
20 | <%= f.submit 'Save', class: "btn btn-secondary" %> 21 |
22 |
23 | <% end %> 24 |
25 | -------------------------------------------------------------------------------- /app/views/admin/pages/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 | <%= logo_for_page(@page) %>  5 | <%= @page.page_type %>
6 |
7 |

8 |
9 | <%= link_to edit_admin_page_path(@page), class: 'btn btn-secondary' do %> 10 | 11 | edit 12 | <% end %> 13 |   14 | <%= link_to admin_pages_path, class: 'btn btn-secondary' do %> 15 | 16 | back to list 17 | <% end %> 18 |
19 |
20 | <%= link_to admin_page_path(@page), method: 'delete', data: {confirm: 'Are you sure? There is no UNDO!'}, class: 'btn btn-danger' do %> 21 | 22 | delete 23 | <% end %> 24 |
25 |
26 | 27 |
28 |
Public
29 |
<%= 'Public' if @page.public? %>
30 |
Slug
31 |
<%= @page.slug %>
32 |
Page Type
33 |
<%= @page.page_type %>
34 |
Sort Rank
35 |
<%= @page.rank %>
36 | <% if @page.page_type == 'blog_post' %> 37 |
Blog Categories
38 |
<%= @page.blog_categories.sort_by(&:rank).map{|c| "#{c.name}"}.join(' ').html_safe %>
39 | <% end %> 40 |
 
 
41 |
Created
42 |
<%= @page.created_at.to_s(:gdt) %>
43 |
Last Update
44 |
<%= @page.updated_at.to_s(:gdt) %>
45 | <% [:de, :en].each do |locale| %> 46 |
 
 
47 |
<%= image_tag("flags/#{locale.to_s}.png") %>
48 |
<%= locale %>
49 |
Title
50 |
<%= @page.translation_for(locale).title %>
51 |
 
 
52 |
Body
53 |
<%= markdown(@page.translation_for(locale).body) %>
54 | <% end %> 55 | 56 |
57 |
58 | -------------------------------------------------------------------------------- /app/views/blog_pages/show.html.erb: -------------------------------------------------------------------------------- 1 |

<%= @page.title %>

2 | <%= markdown(@page.body) %> 3 | -------------------------------------------------------------------------------- /app/views/blog_posts/_post.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |   4 | <%= post.created_at.to_s(:gdt) %> 5 | <% if post.blog_categories.any? %> 6 |   7 |   8 | <%= raw(post.blog_categories.map {|c| link_to c.name, blog_category_path(c.slug)}.join(', ')) %> 9 | <% end %> 10 |
11 | 12 |

13 | <%= link_to post.title, blog_post_path(post.id) %> 14 |

15 | <% if post.abstract.present? %> 16 |
17 | <%= markdown(post.abstract) %> 18 |
19 |

20 | <%= link_to t('blog.blogarticle.more'), blog_post_path(post.id) %> 21 |

22 | <% else %> 23 |
24 | <%= markdown(post.main_body) %> 25 |
26 | <% end %> 27 | 28 |
29 | -------------------------------------------------------------------------------- /app/views/blog_posts/index.html.erb: -------------------------------------------------------------------------------- 1 | <%= render partial: 'blog_posts/post', collection: @posts, as: :post %> 2 | -------------------------------------------------------------------------------- /app/views/blog_posts/show.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :facebook_meta_tags do %> 2 | <%= render('shared/facebook_meta_tags', post: @post) %> 3 | <% end %> 4 | 5 |
6 |

<%= @post.title %>

7 | <%= markdown(@post.full_body) %> 8 |
9 | -------------------------------------------------------------------------------- /app/views/events/_all_events_donut.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 22 | -------------------------------------------------------------------------------- /app/views/events/_comment.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

3 | 4 | <%= comment.title %> 5 |

6 |

7 | 8 | <%= comment.created_at.to_s(:gdt) %> 9 |   10 | 11 | <%= comment.author %> 12 | <% if comment.public_contact %> 13 |   14 | 15 | <%= linked_contact_info(comment.public_contact).html_safe %> 16 | <% end %> 17 |

18 |
19 | <%= simple_format(comment.body) %> 20 |
21 | 22 |
23 | -------------------------------------------------------------------------------- /app/views/events/_comment_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= bootstrap_form_for [event, comment] do |f| %> 2 | 3 | <%= t('fieldset.legend.comment.add_a_comment') %> 4 | <%= f.text_field :title %> 5 | <%= f.text_field :author %> 6 | <%= f.text_field :public_contact %> 7 | <%= f.text_area :body %> 8 | 9 | 10 | <%= t('fieldset.legend.comment.extra_info') %> 11 | <%= f.text_field :internal_contact %> 12 | 13 | 14 | <%= f.submit 'Save', class: 'btn btn-success' %> 15 | <% end %> -------------------------------------------------------------------------------- /app/views/events/_donut.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 22 | -------------------------------------------------------------------------------- /app/views/events/_form_fields.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= t('fieldset.legend.event.what') %> 3 | <%= f.text_field :title %> 4 | <%= f.text_area :description %> 5 | <%= f.url_field :main_url %> 6 |
7 | 8 |
9 | <%= t('fieldset.legend.event.when_and_where') %> 10 | <%= f.date_select :date, start_year: 1997 %> 11 | <%= f.text_field :city %> 12 |
13 | <%= label_tag 'event_country_code', t('helpers.label.event.country_code'), class: 'col-form-label' %> 14 | <%= country_select :event, :country_code, {priority_countries: %w(DE AU CH FR NL GB US)}, {class: 'form-control'} %> 15 | <%= t('activerecord.help.event.country_code') %> 16 |
17 |
18 | 19 |
20 | <%= t('fieldset.legend.event.who') %> 21 | <%= f.text_area :organizers %> 22 | <%= f.text_field :contact_url %> 23 | <%= f.text_field :contact_twitter %> 24 | <%= f.text_field :contact_email %> 25 |
26 | 27 |
28 | <%= t('fieldset.legend.event.topics') %> 29 | <%= f.text_field :tag_list, value: f.object.tag_list.to_s %> 30 |
31 | 32 |
33 | <%= t('fieldset.legend.event.speakers') %> 34 | <%= f.number_field :woman, min: 0 %> 35 | <%= f.number_field :total, min: 0, label: t('helpers.label.event.total_html') %> 36 | <%= f.url_field :speaker_list_url %> 37 | <%= f.text_field :remark %> 38 |
39 | 40 |
41 | <%= t('fieldset.legend.event.and_you') %> 42 | <%= f.text_field :reporter %> 43 | <%= f.text_field :reporter_twitter %> 44 | <%= f.text_field :reporter_url %> 45 | <%= f.text_field :reporter_email %> 46 |
47 | 48 |
49 | 50 | <%= t('fieldset.legend.event.finally') %> 51 | <%= f.text_area :internal_user_info %> 52 |
53 | -------------------------------------------------------------------------------- /app/views/events/_tag_or_search_summery.html.erb: -------------------------------------------------------------------------------- 1 | <% if params[:q] %> 2 |
3 |
4 | Search: "<%= params[:q] %>" — 5 | <%= page_entries_info @events %>

6 |
7 |
8 | <% elsif params[:tag] %> 9 |
10 |
11 | Tag: "<%= params[:tag] %>" — 12 | <%= page_entries_info @events %>

13 |
14 |
15 | <% end %> 16 | -------------------------------------------------------------------------------- /app/views/events/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Veranstaltung bearbeiten:

2 | 3 |

4 | This event can still be edited by you for 5 | <%= (@event.remaining_edit_time / 60.0).to_i %> minutes. 6 | Counting from the moment, this page was loaded by 7 | you browser. So go ahead and edit it: 8 |

9 | 10 | <%= bootstrap_form_for(@event) do |f| %> 11 | <%= render partial: 'form_fields', locals: {f: f} %> 12 | <%= f.submit 'Update', class: 'btn btn-success'%> 13 | <%= link_to raw(' Cancel'), 14 | event_path(@event), 15 | class: 'btn btn-primary' %> 16 | <% end %> 17 | 18 |

19 |
20 | After updating, this event can still be edited by you for 21 | <%= (@event.remaining_edit_time / 60.0).to_i %> minutes. 22 | Counting from the moment, this page was loaded by 23 | you browser.


24 |

25 | -------------------------------------------------------------------------------- /app/views/events/index.html.erb: -------------------------------------------------------------------------------- 1 | <%= render partial: 'tag_or_search_summery' %> 2 | 3 | 11 | 12 | <%= render @events %> 13 | 14 | <% if @events.any? %> 15 |
16 |
17 | <%= page_entries_info @events %> 18 |
19 |
20 | <%= paginate @events %> 21 |
22 |
23 | <% end %> 24 | -------------------------------------------------------------------------------- /app/views/events/new.html.erb: -------------------------------------------------------------------------------- 1 |

<%= t 'new.event.title' %>:

2 | 3 | <%= t 'new.event.explain_html' %> 4 | 5 | <%= bootstrap_form_for(@event) do |f| %> 6 | <%= render partial: 'form_fields', locals: {f: f} %> 7 | <%= f.submit t('new.event.save'), class: "btn btn-success" %> 8 | <% end %> 9 | <%= t 'new.event.thank_you_html' %> -------------------------------------------------------------------------------- /app/views/events/show.html.erb: -------------------------------------------------------------------------------- 1 | <%= render @event %> 2 | 3 | <% if @event.frontend_editable?(session[:reported_events_ids]) %> 4 |

5 |


6 | This event can still be edited by you for 7 | <%= (@event.remaining_edit_time / 60.0).to_i %> minutes. 8 | Counting from the moment, this page was loaded by 9 | you browser. 10 |

11 | <%= link_to raw(' Edit'), 12 | edit_event_path(@event), 13 | class: 'btn btn-primary' %> 14 | <% end %> 15 | 16 | <% if @event.comments.published.any? %> 17 |
18 |

<%= t 'show.event.your_comments' %>:

19 | <%= render partial: 'events/comment', collection: @event.comments.published %> 20 |
21 | <% end %> 22 | 23 | <% if @event.published? %> 24 | <%= render "events/comment_form", event: @event, comment: @comment %> 25 | <% end %> 26 | 27 | <% if current_user %> 28 | <%= link_to edit_admin_event_path(@event), class: 'btn btn-primary' do %> 29 | Admin: 30 | 31 | edit 32 | <% end %> 33 | 34 | <% end %> 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/views/kaminari/_first_page.html.erb: -------------------------------------------------------------------------------- 1 |
  • 2 | <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote, class: "page-link" %> 3 |
  • 4 | -------------------------------------------------------------------------------- /app/views/kaminari/_gap.html.erb: -------------------------------------------------------------------------------- 1 |
  • 2 | <%= content_tag :a, raw(t 'views.pagination.truncate') %> 3 |
  • 4 | -------------------------------------------------------------------------------- /app/views/kaminari/_last_page.html.erb: -------------------------------------------------------------------------------- 1 |
  • 2 | <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote, class: "page-link"} %> 3 |
  • 4 | -------------------------------------------------------------------------------- /app/views/kaminari/_next_page.html.erb: -------------------------------------------------------------------------------- 1 |
  • 2 | <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote, class: "page-link" %> 3 |
  • 4 | -------------------------------------------------------------------------------- /app/views/kaminari/_page.html.erb: -------------------------------------------------------------------------------- 1 | <% if page.current? %> 2 |
  • 3 | <%= content_tag :a, page, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)), class: "page-link" %> 4 |
  • 5 | <% else %> 6 |
  • 7 | <%= link_to page, url, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)), class: "page-link" %> 8 |
  • 9 | <% end %> 10 | -------------------------------------------------------------------------------- /app/views/kaminari/_paginator.html.erb: -------------------------------------------------------------------------------- 1 | <%= paginator.render do -%> 2 | 15 | <% end -%> 16 | -------------------------------------------------------------------------------- /app/views/kaminari/_prev_page.html.erb: -------------------------------------------------------------------------------- 1 |
  • 2 | <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote, class: "page-link" %> 3 |
  • 4 | -------------------------------------------------------------------------------- /app/views/layouts/admin.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Ammin - Fiftypercent 8 | 9 | <%= stylesheet_link_tag 'application', media: 'all' %> 10 | <%= javascript_include_tag 'application' %> 11 | <%= csrf_meta_tags %> 12 | 13 | 14 | 15 | <%= render 'shared/admin_menu' %> 16 | 17 |
    18 | 19 | <%= flash_messages %> 20 | 21 |
    22 |
    23 | <%= yield %> 24 |
    25 |
    26 |
    27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | <%= t(:title, scope: 'layout.header') %> 8 | 9 | <%= stylesheet_link_tag 'application', media: 'all' %> 10 | <%= javascript_include_tag 'application' %> 11 | <%= csrf_meta_tags %> 12 | 13 | 14 | 15 | <%= render 'shared/header' %> 16 | 17 |
    18 | <% if Rails.env.development? %> 19 | <%= render 'shared/debug' %> 20 | <% end %> 21 | <%= flash_messages %> 22 | 23 | 47 | 48 |
    49 |
    50 | <%= yield %> 51 |
    52 |
    53 |
    54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /app/views/layouts/blog.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Speakerinnen Blog 8 | 9 | <%= stylesheet_link_tag 'blog', media: 'all' %> 10 | <%= javascript_include_tag 'application' %> 11 | <%= csrf_meta_tags %> 12 | <% if content_for?(:facebook_meta_tags) %> 13 | <%= yield :facebook_meta_tags %> 14 | <% else %> 15 | <%= render('shared/facebook_meta_tags', post: Page.blog_posts.last) %> 16 | <% end %> 17 | 18 | 19 | 20 | <%= render 'shared/blog_header' %> 21 |
    22 | 23 | <% if Rails.env.development? %> 24 | <%= render 'shared/debug' %> 25 | <% end %> 26 | <%= flash_messages %> 27 | 28 |
    29 |
    30 | <% if @blog_category %> 31 |

    32 |   33 | <%= @blog_category.name %> 34 |

    35 | <% end %> 36 | <%= yield %> 37 |
    38 |
    39 | <%= render 'shared/blog_sidebar' %> 40 |
    41 |
    42 | 43 |
    44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/views/notifications_mailer/new_event.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

    Hallo Anne!

    7 |

    Es gibt einen neuen Eintrag. Die neu erstellte Konferenz hat die ID: <%= @event.id %>, den Titel <%= @event.title %> und wurde von <%= @event.reporter.present? ? @event.reporter : "Admin"%> eingestellt.

    8 |

    Hier kannst Du sie freischalten: <%= @url %>. 9 |

    Einen schönen Tag noch!!!

    10 | 11 | 12 | -------------------------------------------------------------------------------- /app/views/pages/show.html.erb: -------------------------------------------------------------------------------- 1 |

    <%= @page.title if @page.title %>

    2 | <%= markdown(@page.body)if @page.body %> 3 | -------------------------------------------------------------------------------- /app/views/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |

    Log in

    2 | 3 | 4 | <%= bootstrap_form_tag url: '/sessions' do |f| %> 5 | 6 | <%= f.email_field :email %> 7 | 8 | <%= f.password_field :password %> 9 | 10 | <%= f.submit 'Submit' %> 11 | 12 | <% end %> 13 | -------------------------------------------------------------------------------- /app/views/shared/_admin_menu.html.erb: -------------------------------------------------------------------------------- 1 | 51 | -------------------------------------------------------------------------------- /app/views/shared/_blog_header.html.erb: -------------------------------------------------------------------------------- 1 | <%# admin_header_class = 'admin' if controller_path =~ /admin\// %> 2 |
    3 | 4 | 40 | 41 | 42 | 43 | 44 |
    45 | -------------------------------------------------------------------------------- /app/views/shared/_blog_sidebar.html.erb: -------------------------------------------------------------------------------- 1 | 36 | -------------------------------------------------------------------------------- /app/views/shared/_debug.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/app/views/shared/_debug.html.erb -------------------------------------------------------------------------------- /app/views/shared/_facebook_meta_tags.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/views/shared/_sidebar.html.erb: -------------------------------------------------------------------------------- 1 | <% Page.sidebar_snippets.order(:rank).includes(:translations).all.each do |snippet| %> 2 | 6 | <% end %> 7 |
    8 | 21 | 22 | 27 | -------------------------------------------------------------------------------- /app/views/users/new.html.erb: -------------------------------------------------------------------------------- 1 |

    Sign up

    2 | <%= bootstrap_form_for(@user) do |f| %> 3 | 4 | <%= f.email_field :email %> 5 | 6 | <%= f.password_field :password %> 7 | <%= f.password_field :password_confirmation %> 8 | 9 | <%= f.submit 'Submit' %> 10 | <% end %> 11 | 12 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../config/application', __dir__) 3 | require_relative "../config/boot" 4 | require "rails/commands" 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative "../config/boot" 3 | require "rake" 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require "fileutils" 3 | 4 | # path to your application root. 5 | APP_ROOT = File.expand_path('..', __dir__) 6 | 7 | def system!(*args) 8 | system(*args) || abort("\n== Command #{args} failed ==") 9 | end 10 | 11 | FileUtils.chdir APP_ROOT do 12 | # This script is a way to set up or update your development environment automatically. 13 | # This script is idempotent, so that you can run it at any time and get an expectable outcome. 14 | # Add necessary setup steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system('bundle check') || system!('bundle install') 19 | 20 | # Install JavaScript dependencies 21 | system! 'bin/yarn' 22 | 23 | # puts "\n== Copying sample files ==" 24 | # unless File.exist?('config/database.yml') 25 | # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' 26 | # end 27 | 28 | puts "\n== Preparing database ==" 29 | system! 'bin/rails db:prepare' 30 | 31 | puts "\n== Removing old logs and tempfiles ==" 32 | system! 'bin/rails log:clear tmp:clear' 33 | 34 | puts "\n== Restarting application server ==" 35 | system! 'bin/rails restart' 36 | end 37 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'fileutils' 3 | include FileUtils 4 | 5 | # path to your application root. 6 | APP_ROOT = File.expand_path('..', __dir__) 7 | 8 | def system!(*args) 9 | system(*args) || abort("\n== Command #{args} failed ==") 10 | end 11 | 12 | chdir APP_ROOT do 13 | # This script is a way to update your development environment automatically. 14 | # Add necessary update steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system('bundle check') || system!('bundle install') 19 | 20 | # Install JavaScript dependencies if using Yarn 21 | # system('bin/yarn') 22 | 23 | puts "\n== Updating database ==" 24 | system! 'bin/rails db:migrate' 25 | 26 | puts "\n== Removing old logs and tempfiles ==" 27 | system! 'bin/rails log:clear tmp:clear' 28 | 29 | puts "\n== Restarting application server ==" 30 | system! 'bin/rails restart' 31 | end 32 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_ROOT = File.expand_path('..', __dir__) 3 | Dir.chdir(APP_ROOT) do 4 | yarn = ENV["PATH"].split(File::PATH_SEPARATOR). 5 | select { |dir| File.expand_path(dir) != __dir__ }. 6 | product(["yarn", "yarn.cmd", "yarn.ps1"]). 7 | map { |dir, file| File.expand_path(file, dir) }. 8 | find { |file| File.executable?(file) } 9 | 10 | if yarn 11 | exec yarn, *ARGV 12 | else 13 | $stderr.puts "Yarn executable was not detected in the system." 14 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" 15 | exit 1 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative "config/environment" 4 | 5 | run Rails.application 6 | Rails.application.load_server 7 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'csv' 4 | require 'rails/all' 5 | 6 | # Require the gems listed in Gemfile, including any gems 7 | # you've limited to :test, :development, or :production. 8 | Bundler.require(*Rails.groups) 9 | 10 | module Fiftypercent 11 | class Application < Rails::Application 12 | # Settings in config/environments/* take precedence over those specified here. 13 | # Application configuration should go into files in config/initializers 14 | # -- all .rb files in that directory are automatically loaded. 15 | 16 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 17 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 18 | # config.time_zone = 'Central Time (US & Canada)' 19 | 20 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 21 | config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 22 | config.i18n.default_locale = :de 23 | config.i18n.fallbacks = true 24 | config.load_defaults 5.0 25 | 26 | Globalize.fallbacks = {:en => [:en, :de], :de => [:de, :en]} 27 | 28 | config.assets.paths << Rails.root.join("app", "assets", "fonts") 29 | 30 | ActsAsTaggableOn.remove_unused_tags = true 31 | 32 | # throttle requests to prevent mass event posting 33 | config.middleware.use Rack::Attack 34 | 35 | # set to false if you want to see asset-requests in development-logs 36 | # config.quiet_assets = false 37 | 38 | # config.active_record.raise_in_transactional_callbacks = true 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require "bundler/setup" # Set up gems listed in the Gemfile. 4 | require "bootsnap/setup" # Speed up boot time by caching expensive operations. 5 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: fiftypercent_production 11 | -------------------------------------------------------------------------------- /config/database.yml.dist: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 8.2 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On OS X with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On OS X with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | # For details on connection pooling, see rails configuration guide 21 | # http://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: 5 23 | 24 | development: 25 | <<: *default 26 | database: fiftypercent_development 27 | 28 | # The specified database role being used to connect to postgres. 29 | # To create additional roles in postgres see `$ createuser --help`. 30 | # When left blank, postgres will use the default role. This is 31 | # the same name as the operating system user that initialized the database. 32 | #username: fiftypercent 33 | 34 | # The password associated with the postgres role (username). 35 | #password: 36 | 37 | # Connect on a TCP socket. Omitted by default since the client uses a 38 | # domain socket that doesn't need configuration. Windows does not have 39 | # domain sockets, so uncomment these lines. 40 | #host: localhost 41 | 42 | # The TCP port the server listens on. Defaults to 5432. 43 | # If your server runs on a different port number, change accordingly. 44 | #port: 5432 45 | 46 | # Schema search path. The server defaults to $user,public 47 | #schema_search_path: myapp,sharedapp,public 48 | 49 | # Minimum log levels, in increasing order: 50 | # debug5, debug4, debug3, debug2, debug1, 51 | # log, notice, warning, error, fatal, and panic 52 | # Defaults to warning. 53 | #min_messages: notice 54 | 55 | # Warning: The database defined as "test" will be erased and 56 | # re-generated from your development database when you run "rake". 57 | # Do not set this db to the same as development or production. 58 | test: 59 | <<: *default 60 | database: fiftypercent_test 61 | 62 | # As with config/secrets.yml, you never want to store sensitive information, 63 | # like your database password, in your source code. If your source code is 64 | # ever seen by anyone, they now have access to your database. 65 | # 66 | # Instead, provide the password as a unix environment variable when you boot 67 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database 68 | # for a full rundown on how to provide these environment variables in a 69 | # production deployment. 70 | # 71 | # On Heroku and other platform providers, you may have a full connection URL 72 | # available as an environment variable. For example: 73 | # 74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 75 | # 76 | # You can use this database configuration with: 77 | # 78 | # production: 79 | # url: <%= ENV['DATABASE_URL'] %> 80 | # 81 | production: 82 | <<: *default 83 | database: fiftypercent_production 84 | username: fiftypercent 85 | password: <%= ENV['FIFTYPERCENT_DATABASE_PASSWORD'] %> 86 | -------------------------------------------------------------------------------- /config/deploy.rb: -------------------------------------------------------------------------------- 1 | # config valid only for Capistrano 3.1 2 | lock '3.18.0' 3 | 4 | set :application, 'fiftypercent' 5 | set :repo_url, 'git@github.com:rubymonsters/fiftypercent.git' 6 | set :stage, :production 7 | set :deploy_via, :remote_cache 8 | 9 | 10 | # Default branch is :master 11 | # ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call 12 | set :branch, ENV['BRANCH'] if ENV['BRANCH'] 13 | 14 | # Default deploy_to directory is /var/www/my_app 15 | set :deploy_to, '/home/fiftypercent' 16 | 17 | # Default value for :scm is :git 18 | # set :scm, :git 19 | 20 | # Default value for :format is :pretty 21 | # set :format, :pretty 22 | 23 | # Default value for :log_level is :debug 24 | set :log_level, :info 25 | 26 | # Default value for :pty is false 27 | # set :pty, true 28 | 29 | # Default value for :linked_files is [] 30 | set :linked_files, %w{config/database.yml config/secrets.yml} 31 | 32 | # see: https://github.com/capistrano/bundler/issues/45 33 | set :bundle_binstubs, nil 34 | 35 | # Default value for linked_dirs is [] 36 | set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/images} 37 | 38 | # Default value for default_env is {} 39 | # set :default_env, { path: "/opt/ruby/bin:$PATH" } 40 | 41 | # Default value for keep_releases is 5 42 | set :keep_releases, 5 43 | 44 | # If you want to restart using `touch tmp/restart.txt`, add this to your config/deploy.rb: 45 | set :passenger_restart_with_touch, true 46 | 47 | namespace :deploy do 48 | 49 | desc 'Restart application' 50 | task :restart do 51 | on roles(:app), in: :sequence, wait: 5 do 52 | # Your restart mechanism here, for example: 53 | execute :touch, release_path.join('tmp/restart.txt') 54 | end 55 | end 56 | 57 | after :publishing, :restart 58 | 59 | after :restart, :clear_cache do 60 | on roles(:web), in: :groups, limit: 3, wait: 10 do 61 | # Here we can do anything such as: 62 | # within release_path do 63 | # execute :rake, 'cache:clear' 64 | # end 65 | end 66 | end 67 | 68 | end 69 | -------------------------------------------------------------------------------- /config/deploy/production.rb: -------------------------------------------------------------------------------- 1 | # Simple Role Syntax 2 | # ================== 3 | # Supports bulk-adding hosts to roles, the primary server in each group 4 | # is considered to be the first unless any hosts have the primary 5 | # property set. Don't declare `role :all`, it's a meta role. 6 | # role :app, %w{fiftypercent@kvm15.so36.net} 7 | # role :web, %w{fiftypercent@kvm15.so36.net} 8 | # role :db, %w{fiftypercent@kvm15.so36.net} 9 | 10 | require 'net/ssh/proxy/command' 11 | 12 | server 'kvm15.so36.net:1036', 13 | roles: %w(app web db), 14 | user: 'fiftypercent', 15 | primary: true 16 | # ssh_options: { 17 | # port: 1036, # This didn't honored the global ssh_options 18 | # proxy: Net::SSH::Proxy::Command.new('ssh shell -W %h:%p'), 19 | # } 20 | 21 | # Extended Server Syntax 22 | # ====================== 23 | # This can be used to drop a more detailed server definition into the 24 | # server list. The second argument is a, or duck-types, Hash and is 25 | # used to set extended properties on the server. 26 | 27 | # server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value 28 | 29 | 30 | # Custom SSH Options 31 | # ================== 32 | # You may pass any option but keep in mind that net/ssh understands a 33 | # limited set of options, consult[net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start). 34 | # 35 | # Global options 36 | # -------------- 37 | # set :ssh_options, { 38 | # keys: %w(/home/rlisowski/.ssh/id_rsa), 39 | # forward_agent: false, 40 | # auth_methods: %w(password) 41 | # } 42 | # 43 | # And/or per server (overrides global) 44 | # ------------------------------------ 45 | # server 'example.com', 46 | # user: 'user_name', 47 | # roles: %w{web app}, 48 | # ssh_options: { 49 | # user: 'user_name', # overrides user setting above 50 | # keys: %w(/home/user_name/.ssh/id_rsa), 51 | # forward_agent: false, 52 | # auth_methods: %w(publickey password) 53 | # # password: 'please use keys' 54 | # } 55 | -------------------------------------------------------------------------------- /config/deploy/staging.rb: -------------------------------------------------------------------------------- 1 | # Simple Role Syntax 2 | # ================== 3 | # Supports bulk-adding hosts to roles, the primary server in each group 4 | # is considered to be the first unless any hosts have the primary 5 | # property set. Don't declare `role :all`, it's a meta role. 6 | 7 | role :app, %w{deploy@example.com} 8 | role :web, %w{deploy@example.com} 9 | role :db, %w{deploy@example.com} 10 | 11 | 12 | # Extended Server Syntax 13 | # ====================== 14 | # This can be used to drop a more detailed server definition into the 15 | # server list. The second argument is a, or duck-types, Hash and is 16 | # used to set extended properties on the server. 17 | 18 | server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value 19 | 20 | 21 | # Custom SSH Options 22 | # ================== 23 | # You may pass any option but keep in mind that net/ssh understands a 24 | # limited set of options, consult[net/ssh documentation](http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start). 25 | # 26 | # Global options 27 | # -------------- 28 | # set :ssh_options, { 29 | # keys: %w(/home/rlisowski/.ssh/id_rsa), 30 | # forward_agent: false, 31 | # auth_methods: %w(password) 32 | # } 33 | # 34 | # And/or per server (overrides global) 35 | # ------------------------------------ 36 | # server 'example.com', 37 | # user: 'user_name', 38 | # roles: %w{web app}, 39 | # ssh_options: { 40 | # user: 'user_name', # overrides user setting above 41 | # keys: %w(/home/user_name/.ssh/id_rsa), 42 | # forward_agent: false, 43 | # auth_methods: %w(publickey password) 44 | # # password: 'please use keys' 45 | # } 46 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative "application" 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # In the development environment your application's code is reloaded any time 7 | # it changes. This slows down response time but is perfect for development 8 | # since you don't have to restart the web server when you make code changes. 9 | config.cache_classes = false 10 | 11 | # Do not eager load code on boot. 12 | config.eager_load = false 13 | 14 | # Show full error reports. 15 | config.consider_all_requests_local = true 16 | 17 | # Enable/disable caching. By default caching is disabled. 18 | # Run rails dev:cache to toggle caching. 19 | if Rails.root.join('tmp', 'caching-dev.txt').exist? 20 | config.action_controller.perform_caching = true 21 | config.action_controller.enable_fragment_cache_logging = true 22 | 23 | config.cache_store = :memory_store 24 | config.public_file_server.headers = { 25 | 'Cache-Control' => "public, max-age=#{2.days.to_i}" 26 | } 27 | else 28 | config.action_controller.perform_caching = false 29 | 30 | config.cache_store = :null_store 31 | end 32 | 33 | # Store uploaded files on the local file system (see config/storage.yml for options). 34 | config.active_storage.service = :local 35 | 36 | # Don't care if the mailer can't send. 37 | config.action_mailer.raise_delivery_errors = false 38 | 39 | config.action_mailer.perform_caching = false 40 | 41 | # Print deprecation notices to the Rails logger. 42 | config.active_support.deprecation = :log 43 | 44 | # Raise exceptions for disallowed deprecations. 45 | config.active_support.disallowed_deprecation = :raise 46 | 47 | # Tell Active Support which deprecation messages to disallow. 48 | config.active_support.disallowed_deprecation_warnings = [] 49 | 50 | # Raise an error on page load if there are pending migrations. 51 | config.active_record.migration_error = :page_load 52 | 53 | # Highlight code that triggered database queries in logs. 54 | config.active_record.verbose_query_logs = true 55 | 56 | # Debug mode disables concatenation and preprocessing of assets. 57 | # This option may cause significant delays in view rendering with a large 58 | # number of complex assets. 59 | config.assets.debug = true 60 | 61 | # Suppress logger output for asset requests. 62 | config.assets.quiet = true 63 | 64 | # Raises error for missing translations. 65 | # config.i18n.raise_on_missing_translations = true 66 | 67 | # Annotate rendered view with file names. 68 | # config.action_view.annotate_rendered_view_with_filenames = true 69 | 70 | # Use an evented file watcher to asynchronously detect changes in source code, 71 | # routes, locales, etc. This feature depends on the listen gem. 72 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 73 | 74 | # Uncomment if you wish to allow Action Cable access from any origin. 75 | # config.action_cable.disable_request_forgery_protection = true 76 | end 77 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | # The test environment is used exclusively to run your application's 4 | # test suite. You never need to work with it otherwise. Remember that 5 | # your test database is "scratch space" for the test suite and is wiped 6 | # and recreated between test runs. Don't rely on the data there! 7 | 8 | Rails.application.configure do 9 | # Settings specified here will take precedence over those in config/application.rb. 10 | 11 | config.cache_classes = true 12 | 13 | # Do not eager load code on boot. This avoids loading your whole application 14 | # just for the purpose of running a single test. If you are using a tool that 15 | # preloads Rails for running tests, you may have to set it to true. 16 | config.eager_load = false 17 | 18 | # Configure public file server for tests with Cache-Control for performance. 19 | config.public_file_server.enabled = true 20 | config.public_file_server.headers = { 21 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 22 | } 23 | 24 | # Show full error reports and disable caching. 25 | config.consider_all_requests_local = true 26 | config.action_controller.perform_caching = false 27 | config.cache_store = :null_store 28 | 29 | # Raise exceptions instead of rendering exception templates. 30 | config.action_dispatch.show_exceptions = false 31 | 32 | # Disable request forgery protection in test environment. 33 | config.action_controller.allow_forgery_protection = false 34 | 35 | # Store uploaded files on the local file system in a temporary directory. 36 | config.active_storage.service = :test 37 | 38 | config.action_mailer.perform_caching = false 39 | 40 | # Tell Action Mailer not to deliver emails to the real world. 41 | # The :test delivery method accumulates sent emails in the 42 | # ActionMailer::Base.deliveries array. 43 | config.action_mailer.delivery_method = :test 44 | 45 | # Print deprecation notices to the stderr. 46 | config.active_support.deprecation = :stderr 47 | 48 | # Raise exceptions for disallowed deprecations. 49 | config.active_support.disallowed_deprecation = :raise 50 | 51 | # Tell Active Support which deprecation messages to disallow. 52 | config.active_support.disallowed_deprecation_warnings = [] 53 | 54 | # Raises error for missing translations. 55 | # config.i18n.raise_on_missing_translations = true 56 | 57 | # Annotate rendered view with file names. 58 | # config.action_view.annotate_rendered_view_with_filenames = true 59 | end 60 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ActiveSupport::Reloader.to_prepare do 4 | # ApplicationController.renderer.defaults.merge!( 5 | # http_host: 'example.org', 6 | # https: false 7 | # ) 8 | # end 9 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path. 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | # Add Yarn node_modules folder to the asset load path. 9 | Rails.application.config.assets.paths << Rails.root.join('node_modules') 10 | 11 | # Precompile additional assets. 12 | # application.js, application.css, and all non-JS/CSS in the app/assets 13 | # folder are already added. 14 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 15 | Rails.application.config.assets.precompile += %w( blog.css ) 16 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code 7 | # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". 8 | Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"] 9 | -------------------------------------------------------------------------------- /config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Define an application-wide content security policy 4 | # For further information see the following documentation 5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy 6 | 7 | # Rails.application.config.content_security_policy do |policy| 8 | # policy.default_src :self, :https 9 | # policy.font_src :self, :https, :data 10 | # policy.img_src :self, :https, :data 11 | # policy.object_src :none 12 | # policy.script_src :self, :https 13 | # policy.style_src :self, :https 14 | # # If you are using webpack-dev-server then specify webpack-dev-server host 15 | # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? 16 | 17 | # # Specify URI for violation reports 18 | # # policy.report_uri "/csp-violation-report-endpoint" 19 | # end 20 | 21 | # If you are using UJS then enable automatic nonce generation 22 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } 23 | 24 | # Set the nonce only to specific directives 25 | # Rails.application.config.content_security_policy_nonce_directives = %w(script-src) 26 | 27 | # Report CSP violations to a specified URI 28 | # For further information see the following documentation: 29 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 30 | # Rails.application.config.content_security_policy_report_only = true 31 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /config/initializers/date_time_formats.rb: -------------------------------------------------------------------------------- 1 | Time::DATE_FORMATS[:gd] = "%d.%m.%Y" 2 | Time::DATE_FORMATS[:gdt] = "%d.%m.%Y - %H:%M" 3 | Time::DATE_FORMATS[:gdts] = "%d.%m.%Y - %H:%M:%S" -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [ 5 | :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn 6 | ] 7 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/kaminari_config.rb: -------------------------------------------------------------------------------- 1 | Kaminari.configure do |config| 2 | config.default_per_page = 20 3 | # config.max_per_page = nil 4 | # config.window = 4 5 | # config.outer_window = 0 6 | # config.left = 0 7 | # config.right = 0 8 | # config.page_method_name = :page 9 | # config.param_name = :page 10 | end 11 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/new_framework_defaults_5_2.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains migration options to ease your Rails 5.2 upgrade. 4 | # 5 | # Once upgraded flip defaults one by one to migrate to the new default. 6 | # 7 | # Read the Guide for Upgrading Ruby on Rails for more info on each option. 8 | 9 | # Make Active Record use stable #cache_key alongside new #cache_version method. 10 | # This is needed for recyclable cache keys. 11 | # Rails.application.config.active_record.cache_versioning = true 12 | 13 | # Use AES-256-GCM authenticated encryption for encrypted cookies. 14 | # Also, embed cookie expiry in signed or encrypted cookies for increased security. 15 | # 16 | # This option is not backwards compatible with earlier Rails versions. 17 | # It's best enabled when your entire app is migrated and stable on 5.2. 18 | # 19 | # Existing cookies will be converted on read then written with the new scheme. 20 | # Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true 21 | 22 | # Use AES-256-GCM authenticated encryption as default cipher for encrypting messages 23 | # instead of AES-256-CBC, when use_authenticated_message_encryption is set to true. 24 | # Rails.application.config.active_support.use_authenticated_message_encryption = true 25 | 26 | # Add default protection from forgery to ActionController::Base instead of in 27 | # ApplicationController. 28 | # Rails.application.config.action_controller.default_protect_from_forgery = true 29 | 30 | # Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and 31 | # 'f' after migrating old data. 32 | # Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true 33 | 34 | # Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header. 35 | # Rails.application.config.active_support.use_sha1_digests = true 36 | 37 | # Make `form_with` generate id attributes for any generated HTML tags. 38 | # Rails.application.config.action_view.form_with_generates_ids = true 39 | -------------------------------------------------------------------------------- /config/initializers/permissions_policy.rb: -------------------------------------------------------------------------------- 1 | # Define an application-wide HTTP permissions policy. For further 2 | # information see https://developers.google.com/web/updates/2018/06/feature-policy 3 | # 4 | # Rails.application.config.permissions_policy do |f| 5 | # f.camera :none 6 | # f.gyroscope :none 7 | # f.microphone :none 8 | # f.usb :none 9 | # f.fullscreen :self 10 | # f.payment :self, "https://secure.example.com" 11 | # end 12 | -------------------------------------------------------------------------------- /config/initializers/rack-attack.rb: -------------------------------------------------------------------------------- 1 | if Rails.env.production? 2 | Rack::Attack.throttle('events/create', :limit => 1, :period => 120.seconds) do |req| 3 | req.ip if req.path == '/events' && req.post? 4 | end 5 | 6 | # Throttle login attempts for a given email parameter to 6 reqs/minute 7 | # Return the email as a discriminator on POST /login requests 8 | Rack::Attack.throttle('logins/', :limit => 3, :period => 60.seconds) do |req| 9 | req.params['email'] if ['/log_in', '/sessions'].include?(req.path) && req.post? 10 | end 11 | end -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_fiftypercent_session' 4 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/kaminari.yml: -------------------------------------------------------------------------------- 1 | de: 2 | views: 3 | pagination: 4 | first: "«" 5 | last: "»" 6 | previous: "‹ zurück" 7 | next: "weiter ›" 8 | truncate: "…" 9 | helpers: 10 | page_entries_info: 11 | one_page: 12 | display_entries: 13 | zero: "Keine %{entry_name} gefunden" 14 | one: "1 %{entry_name}" 15 | other: "Alle %{count} %{entry_name}" 16 | more_pages: 17 | display_entries: "Eintrag %{first} - %{last} von %{total} insgesamt" 18 | en: 19 | views: 20 | pagination: 21 | first: "«" 22 | last: "»" 23 | previous: "‹ Prev" 24 | next: "Next ›" 25 | truncate: "…" 26 | helpers: 27 | page_entries_info: 28 | one_page: 29 | display_entries: 30 | zero: "No %{entry_name} found" 31 | one: "Displaying 1 %{entry_name}" 32 | other: "Displaying all %{count} %{entry_name}" 33 | more_pages: 34 | display_entries: "Displaying %{entry_name} %{first} - %{last} of %{total} in total" -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers: a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum; this matches the default thread size of Active Record. 6 | # 7 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } 8 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } 9 | threads min_threads_count, max_threads_count 10 | 11 | # Specifies the `worker_timeout` threshold that Puma will use to wait before 12 | # terminating a worker in development environments. 13 | # 14 | worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" 15 | 16 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 17 | # 18 | port ENV.fetch("PORT") { 3000 } 19 | 20 | # Specifies the `environment` that Puma will run in. 21 | # 22 | environment ENV.fetch("RAILS_ENV") { "development" } 23 | 24 | # Specifies the `pidfile` that Puma will use. 25 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } 26 | 27 | # Specifies the number of `workers` to boot in clustered mode. 28 | # Workers are forked web server processes. If using threads and workers together 29 | # the concurrency of the application would be max `threads` * `workers`. 30 | # Workers do not work on JRuby or Windows (both of which do not support 31 | # processes). 32 | # 33 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 34 | 35 | # Use the `preload_app!` method when specifying a `workers` number. 36 | # This directive tells Puma to first boot the application and load code 37 | # before forking the application. This takes advantage of Copy On Write 38 | # process behavior so workers use less memory. 39 | # 40 | # preload_app! 41 | 42 | # Allow puma to be restarted by `rails restart` command. 43 | plugin :tmp_restart 44 | -------------------------------------------------------------------------------- /config/secrets.yml.dist: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: 65c215b9771dfc6c9527a9e714f5f64d712b8ae3d912ebb8cb411290b68549dd90f3219ee899f9bbf235b5a02d0d03022ac6b934bb4efc426aa06e217c99cb49 15 | 16 | test: 17 | secret_key_base: 2ad4b9ad5f692b985a69941acb5ee4e74e7c52665d1094e618b91a68cbe74598d275cc491eea5537377d7e7880c1bcc6bbb101c13ba2d3ba4438be761fca89bf 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | # production: 22 | # secret_key_base: 23 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | %w[ 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ].each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket 23 | 24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /db/migrate/20140830194951_create_events.rb: -------------------------------------------------------------------------------- 1 | class CreateEvents < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :events do |t| 4 | t.text :title 5 | t.text :subtitle 6 | t.datetime :date 7 | t.string :city 8 | t.string :country 9 | t.text :description 10 | t.string :main_url 11 | t.string :contact_url 12 | t.string :speaker_list_url 13 | t.integer :woman 14 | t.integer :total 15 | t.string :category 16 | t.string :reporter 17 | t.string :reporter_url 18 | 19 | t.timestamps 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /db/migrate/20140908141549_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from acts_as_taggable_on_engine (originally 1) 2 | class ActsAsTaggableOnMigration < ActiveRecord::Migration[4.2] 3 | def self.up 4 | create_table :tags do |t| 5 | t.string :name 6 | end 7 | 8 | create_table :taggings do |t| 9 | t.references :tag 10 | 11 | # You should make sure that the column created is 12 | # long enough to store the required class names. 13 | t.references :taggable, polymorphic: true 14 | t.references :tagger, polymorphic: true 15 | 16 | # Limit is created to prevent MySQL error on index 17 | # length for MyISAM table type: http://bit.ly/vgW2Ql 18 | t.string :context, limit: 128 19 | 20 | t.datetime :created_at 21 | end 22 | 23 | add_index :taggings, :tag_id 24 | add_index :taggings, [:taggable_id, :taggable_type, :context] 25 | end 26 | 27 | def self.down 28 | drop_table :taggings 29 | drop_table :tags 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /db/migrate/20140908141550_add_missing_unique_indices.acts_as_taggable_on_engine.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from acts_as_taggable_on_engine (originally 2) 2 | class AddMissingUniqueIndices < ActiveRecord::Migration[4.2] 3 | def self.up 4 | add_index :tags, :name, unique: true 5 | 6 | remove_index :taggings, :tag_id 7 | remove_index :taggings, [:taggable_id, :taggable_type, :context] 8 | add_index :taggings, 9 | [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], 10 | unique: true, name: 'taggings_idx' 11 | end 12 | 13 | def self.down 14 | remove_index :tags, :name 15 | 16 | remove_index :taggings, name: 'taggings_idx' 17 | add_index :taggings, :tag_id 18 | add_index :taggings, [:taggable_id, :taggable_type, :context] 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /db/migrate/20140908141551_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from acts_as_taggable_on_engine (originally 3) 2 | class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[4.2] 3 | def self.up 4 | add_column :tags, :taggings_count, :integer, default: 0 5 | 6 | ActsAsTaggableOn::Tag.reset_column_information 7 | ActsAsTaggableOn::Tag.find_each do |tag| 8 | ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings) 9 | end 10 | end 11 | 12 | def self.down 13 | remove_column :tags, :taggings_count 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20140908141552_add_missing_taggable_index.acts_as_taggable_on_engine.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from acts_as_taggable_on_engine (originally 4) 2 | class AddMissingTaggableIndex < ActiveRecord::Migration[4.2] 3 | def self.up 4 | add_index :taggings, [:taggable_id, :taggable_type, :context] 5 | end 6 | 7 | def self.down 8 | remove_index :taggings, [:taggable_id, :taggable_type, :context] 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20140909171557_create_users.rb: -------------------------------------------------------------------------------- 1 | class CreateUsers < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :users do |t| 4 | t.string :email 5 | t.string :password_hash 6 | t.string :password_salt 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20141030153330_rename_country_on_event_to_country_code.rb: -------------------------------------------------------------------------------- 1 | class RenameCountryOnEventToCountryCode < ActiveRecord::Migration[4.2] 2 | def change 3 | rename_column :events, :country, :country_code 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141106174525_add_text_organizers_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddTextOrganizersToEvents < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :events, :organizers, :text 4 | change_column :events, :contact_url, :text 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20141106180938_add_internal_info_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddInternalInfoToEvents < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :events, :internal_user_info, :text 4 | add_column :events, :internal_admin_info, :text 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20141109113302_add_published_date_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddPublishedDateToEvents < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :events, :published_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141126210657_add_remark_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddRemarkToEvents < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :events, :remark, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20141230123146_create_comments.rb: -------------------------------------------------------------------------------- 1 | class CreateComments < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :comments do |t| 4 | t.text :title 5 | t.text :body 6 | t.string :author 7 | t.string :public_contact 8 | t.string :internal_contact 9 | t.datetime :published_at 10 | 11 | t.references :commentable, polymorphic: true 12 | 13 | t.timestamps 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20150207190850_remove_published_at_from_comments.rb: -------------------------------------------------------------------------------- 1 | class RemovePublishedAtFromComments < ActiveRecord::Migration[4.2] 2 | def change 3 | change_table :comments do |t| 4 | t.remove :published_at 5 | t.string :mod_state 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20150219104002_add_mod_state_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddModStateToEvents < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :events, :mod_state, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150222101012_create_pages.rb: -------------------------------------------------------------------------------- 1 | class CreatePages < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :pages do |t| 4 | t.string :slug 5 | t.string :title 6 | t.text :body 7 | t.string :location 8 | t.integer :rank 9 | 10 | t.timestamps null: false 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20150222201454_create_translation_table_for_pages.rb: -------------------------------------------------------------------------------- 1 | class CreateTranslationTableForPages < ActiveRecord::Migration[4.2] 2 | def up 3 | Page.create_translation_table! :title => :string, :body => :text 4 | end 5 | def down 6 | Page.drop_translation_table! 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20150227153932_rename_page_location_to_page_type.rb: -------------------------------------------------------------------------------- 1 | class RenamePageLocationToPageType < ActiveRecord::Migration[4.2] 2 | def change 3 | change_table :pages do |t| 4 | t.rename :location, :page_type 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20150308121020_create_blog_categories.rb: -------------------------------------------------------------------------------- 1 | class CreateBlogCategories < ActiveRecord::Migration[4.2] 2 | 3 | def up 4 | create_table :blog_categories do |t| 5 | t.string :slug 6 | t.string :name 7 | t.integer :rank 8 | 9 | t.timestamps null: false 10 | end 11 | 12 | BlogCategory.create_translation_table! :name => :string 13 | end 14 | 15 | def down 16 | drop_table :blog_categories 17 | 18 | BlogCategory.drop_translation_table! 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /db/migrate/20150308121937_create_join_table_blog_category_page.rb: -------------------------------------------------------------------------------- 1 | class CreateJoinTableBlogCategoryPage < ActiveRecord::Migration[4.2] 2 | def change 3 | create_join_table :blog_categories, :pages do |t| 4 | t.index [:blog_category_id, :page_id] 5 | t.index [:page_id, :blog_category_id] 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20150308233046_create_images.rb: -------------------------------------------------------------------------------- 1 | class CreateImages < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :images do |t| 4 | t.string :name 5 | t.text :description 6 | t.string :file 7 | 8 | t.timestamps null: false 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20150312210330_add_body_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddBodyToEvents < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :events, :body, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150313153715_add_more_contact_info_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddMoreContactInfoToEvents < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :events, :reporter_twitter, :string 4 | add_column :events, :reporter_email, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20151208163422_add_more_contact_info_for_event_organizer_to_events.rb: -------------------------------------------------------------------------------- 1 | class AddMoreContactInfoForEventOrganizerToEvents < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :events, :contact_twitter, :string 4 | add_column :events, :contact_email, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20151209141300_add_public_attribute_to_pages.rb: -------------------------------------------------------------------------------- 1 | class AddPublicAttributeToPages < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :pages, :public, :boolean, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20180918194313_change_collation_for_tag_names.acts_as_taggable_on_engine.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from acts_as_taggable_on_engine (originally 5) 2 | # This migration is added to circumvent issue #623 and have special characters 3 | # work properly 4 | if ActiveRecord.gem_version >= Gem::Version.new('5.0') 5 | class ChangeCollationForTagNames < ActiveRecord::Migration[4.2][4.2]; end 6 | else 7 | class ChangeCollationForTagNames < ActiveRecord::Migration[4.2]; end 8 | end 9 | ChangeCollationForTagNames.class_eval do 10 | def up 11 | if ActsAsTaggableOn::Utils.using_mysql? 12 | execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20180918194314_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from acts_as_taggable_on_engine (originally 6) 2 | if ActiveRecord.gem_version >= Gem::Version.new('5.0') 3 | class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2][4.2]; end 4 | else 5 | class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2]; end 6 | end 7 | AddMissingIndexesOnTaggings.class_eval do 8 | def change 9 | add_index :taggings, :tag_id unless index_exists? :taggings, :tag_id 10 | add_index :taggings, :taggable_id unless index_exists? :taggings, :taggable_id 11 | add_index :taggings, :taggable_type unless index_exists? :taggings, :taggable_type 12 | add_index :taggings, :tagger_id unless index_exists? :taggings, :tagger_id 13 | add_index :taggings, :context unless index_exists? :taggings, :context 14 | 15 | unless index_exists? :taggings, [:tagger_id, :tagger_type] 16 | add_index :taggings, [:tagger_id, :tagger_type] 17 | end 18 | 19 | unless index_exists? :taggings, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy' 20 | add_index :taggings, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy' 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/lib/assets/.keep -------------------------------------------------------------------------------- /lib/capistrano/tasks/util.rake: -------------------------------------------------------------------------------- 1 | namespace :util do 2 | desc 'Show deployed git-revision' 3 | task :revision do 4 | on roles(:all) do 5 | output = capture("tail #{current_path.join('../revisions.log')}") 6 | puts output 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/lib/tasks/.keep -------------------------------------------------------------------------------- /lib/tasks/blog_import.rake: -------------------------------------------------------------------------------- 1 | namespace :blog do 2 | desc 'imports posts from a wordpress WXR File' 3 | 4 | task(import: :environment) do 5 | 6 | file_path = "#{Rails.root}/lib/assets/blog_import.xml" 7 | 8 | items = [] 9 | 10 | File.open(file_path) do |f| 11 | doc = Nokogiri::XML(f) 12 | items = doc.xpath("//channel//item") 13 | end 14 | 15 | articles = items.map do |item| 16 | a = Article.new 17 | a.title = item.at_xpath('title').text 18 | a.pubDate = item.at_xpath('pubDate').text 19 | a.dc_creator = item.at_xpath('dc:creator').text 20 | a.content_encoded = item.at_xpath('content:encoded').text 21 | a.tags = item.xpath('category').map{|node| node['nicename']} 22 | a.post_type = item.at_xpath('wp:post_type').text 23 | a.wp_status = item.at_xpath('wp:status').text 24 | a 25 | end 26 | 27 | articles.reject(&:unwanted?).each do |article| 28 | puts "+------------------------------------------+" 29 | puts article.title 30 | 31 | event = Event.new( 32 | title: article.title, 33 | created_at: article.created_at, 34 | body: article.content_encoded, 35 | tag_list: article.tags.join(', '), 36 | mod_state: 'ok' 37 | ) 38 | event.save!(validate: false) 39 | end 40 | 41 | 42 | 43 | puts "all articles: #{articles.length}" 44 | puts "unwanted articles: #{articles.select(&:unwanted?).length}" 45 | 46 | 47 | end 48 | end -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/log/.keep -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 |

    The page you were looking for doesn't exist.

    62 |

    You may have mistyped the address or the page may have moved.

    63 |
    64 |

    If you are the application owner check the logs for more information.

    65 |
    66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 |

    The change you wanted was rejected.

    62 |

    Maybe you tried to change something you didn't have access to.

    63 |
    64 |

    If you are the application owner check the logs for more information.

    65 |
    66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 |

    We're sorry, but something went wrong.

    62 |
    63 |

    If you are the application owner check the logs for more information.

    64 |
    65 | 66 | 67 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/admin/comments_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Admin::CommentsControllerTest < ActionController::TestCase 4 | test "index should list comment titles" do 5 | get :index, session: { user_id: users(:horst).id } 6 | assert_select 'table' do 7 | assert_select 'td', /Comment\ One/ 8 | end 9 | end 10 | 11 | test "@commentable is not set if there are no fitting parameters" do 12 | get :index, session: { user_id: users(:horst).id } 13 | assert_nil assigns[:commentable] 14 | end 15 | 16 | test "index finds a commentable give the right parameters" do 17 | params = { 18 | commentable_id: events(:car_show).id, 19 | commentable_type: 'Event' 20 | } 21 | get :index, params: params, session: { user_id: users(:horst).id } 22 | assert_equal events(:car_show).id, assigns[:commentable].id 23 | end 24 | 25 | test "if we have a commentable, @comments are only the comments belonging to this commentable." do 26 | params = { 27 | commentable_id: events(:car_show).id, 28 | commentable_type: 'Event' 29 | } 30 | get :index, params: params, session: { user_id: users(:horst).id } 31 | assert_equal 2, assigns[:comments].size 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /test/controllers/admin/events_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class Admin::EventsControllerTest < ActionController::TestCase 4 | 5 | # this behavior here is inherited from Admin::BaseController 6 | test "should redirect to log_in_path if not logged in" do 7 | get :index 8 | assert_redirected_to log_in_path 9 | end 10 | 11 | test "should use the admin layout" do 12 | get :index, session: { user_id: users(:horst).id } 13 | assert_template layout: 'admin' 14 | end 15 | 16 | 17 | test "should get index if logged in" do 18 | get :index, session: { user_id: users(:horst).id } 19 | assert_template :index 20 | end 21 | 22 | test "should list published events titles" do 23 | get :index, session: { user_id: users(:horst).id } 24 | assert_select '#published-events' do 25 | assert_select 'td', /Carshow/ 26 | end 27 | end 28 | 29 | 30 | test "publish-method publishes an event" do 31 | assert_difference 'Event.published.count' do 32 | patch :publish, params: { id: events(:cebit).id }, session: {user_id: users(:horst).id} 33 | end 34 | assert_redirected_to admin_event_path(events(:cebit).id) 35 | end 36 | 37 | test "unpublish-method un-publishes an event" do 38 | assert_difference 'Event.hidden.count' do 39 | patch :hide, params: { id: events(:car_show).id }, session: { user_id: users(:horst).id } 40 | end 41 | assert_redirected_to admin_event_path(events(:car_show).id) 42 | end 43 | 44 | end 45 | -------------------------------------------------------------------------------- /test/controllers/blog_posts_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class BlogPostsControllerTest < ActionController::TestCase 4 | test "should get show" do 5 | blog_post = Page.new(slug: 'a_slug', page_type: 'blog_post', body: 'abc[---]def', public: true) 6 | blog_post.save! 7 | 8 | get :show, params: { id: blog_post.id } 9 | assert_response :success 10 | assert_not_nil assigns(:post) 11 | assert_template :show 12 | end 13 | 14 | test "show action loads the right event" do 15 | blog_post = Page.new(slug: 'a_slug', page_type: 'blog_post', body: 'abc[---]def', public: true) 16 | blog_post.save! 17 | 18 | get :show, params: { id: blog_post.id } 19 | assert_equal assigns(:post), blog_post 20 | end 21 | 22 | test "index should show published blogpost" do 23 | blog_post = Page.new(slug: 'a_slug', page_type: 'blog_post', body: 'abc[---]def', public: true) 24 | blog_post.save! 25 | 26 | get :index 27 | assert_includes assigns(:posts), blog_post 28 | end 29 | 30 | test "index should not show unpublished blogpost" do 31 | blog_post = Page.new(slug: 'a_slug', page_type: 'blog_post', body: 'abc[---]def', public: false) 32 | blog_post.save! 33 | 34 | get :index 35 | assert_not_includes assigns(:posts), blog_post 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/controllers/comments_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class CommentsControllerTest < ActionController::TestCase 4 | test 'valid comments redirect to event-show action' do 5 | event_id = events(:car_show).id 6 | post :create, params: { comment: {title: 'A title', author: 'The Author', body: 'A comment body.'}, 7 | event_id: event_id 8 | } 9 | assert_redirected_to event_path(event_id) 10 | end 11 | 12 | test 'valid comments are saved' do 13 | event_id = events(:car_show).id 14 | assert_difference 'events(:car_show).comments.count' do 15 | post :create, params: { comment: {title: 'A title', author: 'The Author', body: 'A comment body.'}, 16 | event_id: event_id } 17 | end 18 | end 19 | 20 | test 'adding a comment to a missing event throws an error' do 21 | event_id = 666 22 | assert_raises ActiveRecord::RecordNotFound do 23 | post :create, params: { comment: {title: 'A title', author: 'The Author', body: 'A comment body.'}, 24 | event_id: event_id } 25 | end 26 | end 27 | 28 | test 'invalid comments render the event-show view' do 29 | event_id = events(:car_show).id 30 | post :create, params: { comment: {title: 'A title'}, 31 | event_id: event_id } 32 | 33 | assert_not_nil assigns(:event) 34 | assert_not_nil assigns(:comment) 35 | assert_template 'events/show' 36 | end 37 | 38 | end 39 | -------------------------------------------------------------------------------- /test/controllers/pages_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PagesControllerTest < ActionController::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/sessions_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class SessionsControllerTest < ActionController::TestCase 4 | test "should get new" do 5 | get :new 6 | assert_response :success 7 | end 8 | 9 | # create action 10 | test "should log a user in if pw is valid" do 11 | post :create, params: { email: 'horst@mail.com', password: 'geheim' } 12 | assert_equal session[:user_id], users(:horst).id 13 | assert_match /Logged\ in/, flash[:success] # !> ambiguous first argument; put parentheses or even spaces 14 | assert_redirected_to admin_root_path 15 | end 16 | 17 | test "should NOT log a user in if pw is NOT valid" do 18 | post :create, params: { email: 'horst@mail.com', password: 'nicht_das_password' } 19 | assert_not session[:user_id] 20 | assert_match /Invalid/, flash[:alert] # !> ambiguous first argument; put parentheses or even spaces 21 | assert_template :new 22 | end 23 | 24 | # destroy action 25 | 26 | test "calling destroy action logs the user out" do 27 | get :destroy, session: { user_id: users(:horst).id } 28 | assert_not session[:user_id] 29 | assert_match /Logged\ out/, flash[:success] # !> ambiguous first argument; put parentheses or even spaces 30 | assert_redirected_to root_path 31 | end 32 | 33 | end 34 | -------------------------------------------------------------------------------- /test/controllers/users_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class UsersControllerTest < ActionController::TestCase 4 | # test "should get new" do 5 | # get :new 6 | # assert_response :success 7 | # end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/test/fixtures/.keep -------------------------------------------------------------------------------- /test/fixtures/blog_categories.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | slug: MyString 5 | name: MyString 6 | rank: 1 7 | 8 | two: 9 | slug: MyString 10 | name: MyString 11 | rank: 1 12 | -------------------------------------------------------------------------------- /test/fixtures/comments.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | title: Comment One 5 | body: MyText 6 | public_contact: MyString 7 | internal_contact: MyString 8 | commentable: car_show(Event) 9 | 10 | 11 | two: 12 | title: MyText 13 | body: MyText 14 | public_contact: MyString 15 | internal_contact: MyString 16 | commentable: car_show(Event) 17 | -------------------------------------------------------------------------------- /test/fixtures/images.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | name: MyString 5 | description: MyText 6 | file: MyString 7 | 8 | two: 9 | name: MyString 10 | description: MyText 11 | file: MyString 12 | -------------------------------------------------------------------------------- /test/fixtures/pages.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | blog_post: 4 | slug: MyString1 5 | title: MyString 6 | body: MyText 7 | page_type: blog_post 8 | 9 | two: 10 | slug: MyString 11 | title: MyString 12 | body: MyText 13 | page_type: menu_page 14 | rank: 1 15 | -------------------------------------------------------------------------------- /test/fixtures/users.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | horst: 4 | email: horst@mail.com 5 | password_hash: $2a$10$mgRHSpemiQOtin9wqFhxy.HaXKHTAwdgO49o4FAtEMubAOH6w6t7a 6 | password_salt: $2a$10$mgRHSpemiQOtin9wqFhxy. 7 | # password is: "geheim" 8 | 9 | two: 10 | email: MyString 11 | password_hash: MyString 12 | password_salt: MyString 13 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/test/helpers/.keep -------------------------------------------------------------------------------- /test/helpers/sessions_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class SessionsHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/users_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class UsersHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/test/integration/.keep -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/test/mailers/.keep -------------------------------------------------------------------------------- /test/mailers/mailer_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class NotificationsMailerTest < ActionMailer::TestCase 4 | test "send admin notices mail" do 5 | # Send the email, then test that it got queued 6 | email = NotificationsMailer.new_event(events(:car_show)).deliver_now 7 | assert_not ActionMailer::Base.deliveries.empty? 8 | 9 | # Test the body of the sent email contains what we expect it to 10 | assert_equal ['admina@speakerinnen.org'], email.from 11 | assert_equal ['admina@speakerinnen.org', 'anne@speakerinnen.org'], email.to 12 | assert_equal 'New Event in 50 percent', email.subject 13 | end 14 | 15 | end 16 | -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/test/models/.keep -------------------------------------------------------------------------------- /test/models/comment_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class CommentTest < ActiveSupport::TestCase 4 | test 'Ensures title, author, body' do 5 | event = Event.new 6 | comment = event.comments.new 7 | assert_not comment.valid? 8 | assert_equal 3, comment.errors.count 9 | end 10 | end 11 | 12 | class CommentAssociationTest < ActiveSupport::TestCase 13 | test 'Events can have comments' do 14 | assert_kind_of Comment, events(:car_show).comments.new 15 | end 16 | 17 | test 'Car show has two comment from fixtures' do 18 | assert_equal(2, events(:car_show).comments.count) 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /test/models/event_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class EventTest < ActiveSupport::TestCase 4 | test "events know their country name" do 5 | old_locale = I18n.locale 6 | I18n.locale = :de 7 | assert_equal events(:car_show).country_name, 'Deutschland' 8 | I18n.locale = old_locale 9 | end 10 | 11 | test "a new event has the right country name" do 12 | old_locale = I18n.locale 13 | I18n.locale = :fr 14 | assert_equal Event.new(country_code: 'FR').country_name, 'France' 15 | I18n.locale = old_locale 16 | end 17 | 18 | test "should not save an event without a title" do 19 | assert_not Event.new.save 20 | end 21 | 22 | test "search finds events by title" do 23 | assert_equal Event.search('bit').size, 1 24 | assert_equal Event.search('bit').first, events(:cebit) 25 | end 26 | 27 | test "search finds events by subtitle" do 28 | assert_equal Event.search('super').size, 1 29 | assert_equal Event.search('super').first, events(:car_show) 30 | end 31 | 32 | test "search finds events by description" do 33 | assert_equal Event.search('such').size, 1 34 | assert_equal Event.search('such').first, events(:car_show) 35 | end 36 | 37 | test "search finds events by reporter" do 38 | assert_equal Event.search('inge').size, 1 39 | assert_equal Event.search('such').first, events(:car_show) 40 | end 41 | 42 | test "events without a mod_state are unchecked" do 43 | assert Event.new.unchecked? 44 | refute Event.new(mod_state: 'anything').unchecked? 45 | end 46 | 47 | test "events with modstat ok are published" do 48 | assert Event.new(mod_state: 'ok').published? 49 | refute Event.new(mod_state: 'not-ok').published? 50 | end 51 | 52 | test "events with modstat hidden are hidden" do 53 | assert Event.new(mod_state: 'hidden').hidden? 54 | refute Event.new(mod_state: 'not-hidden').hidden? 55 | end 56 | 57 | test "Event.published finds all published events" do 58 | assert_equal Event.published.size, 3 59 | assert_includes Event.published.all, events(:car_show) 60 | assert_includes Event.published.all, events(:flower_conf) 61 | end 62 | 63 | test "Event.unchecked finds all unchecked events" do 64 | assert_equal Event.unchecked.size, 1 65 | assert_equal Event.unchecked.first, events(:cebit) 66 | end 67 | 68 | test "Event.counted finds all counted events" do 69 | assert_equal Event.counted.size, 3 70 | end 71 | 72 | test "Event knows if has been recently_created?" do 73 | event = Event.create!(valid_event_hash) 74 | assert event.recently_created? 75 | end 76 | 77 | test "Event knows if has NOT been recently_created?" do 78 | event = Event.create!(valid_event_hash) 79 | event.created_at = 2.days.ago 80 | event.save! 81 | assert_not event.recently_created? 82 | end 83 | 84 | test 'can be edited by author' do 85 | event = Event.create!(valid_event_hash) 86 | assert event.frontend_editable?([event.id]) 87 | end 88 | 89 | test 'can NOT be edited by author if to old' do 90 | event = Event.create!(valid_event_hash) 91 | event.created_at = 2.hours.ago 92 | assert_not event.frontend_editable?([event.id]) 93 | end 94 | 95 | test 'can NOT be edited by someone else' do 96 | event = Event.create!(valid_event_hash) 97 | assert_not event.frontend_editable?(nil) 98 | end 99 | end 100 | -------------------------------------------------------------------------------- /test/models/page_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PageTest < ActiveSupport::TestCase 4 | 5 | test "pages have a globalized body" do 6 | current_locale = I18n.locale 7 | p = Page.new(slug: 'a_slug', page_type: 'some_type') 8 | 9 | I18n.locale = :de 10 | p.body = 'german body' 11 | I18n.locale = :en 12 | p.body = 'english body' 13 | p.save! 14 | 15 | n = Page.where(slug: 'a_slug').first 16 | assert_equal 'german body', n.translation_for(:de).body 17 | assert_equal 'english body', n.translation_for(:en).body 18 | I18n.locale = current_locale 19 | end 20 | 21 | test "abstract is extracted from the body" do 22 | p = Page.new(slug: 'a_slug', page_type: 'blog_post', body: 'abc[---]def') 23 | p.save! 24 | assert_equal 'abc', p.abstract 25 | end 26 | 27 | test "abstract is nil if body has no separator" do 28 | p = Page.new(slug: 'a_slug', page_type: 'blog_post', body: 'abcdef') 29 | p.save! 30 | assert_nil p.abstract 31 | end 32 | 33 | test "still works if the body is empty" do 34 | p = Page.new(slug: 'a_slug', page_type: 'blog_post', body: nil) 35 | p.save! 36 | assert_nil p.abstract 37 | end 38 | 39 | 40 | 41 | test "main_body is extracted from the body" do 42 | p = Page.new(slug: 'a_slug', page_type: 'blog_post', body: 'abc[---]def') 43 | p.save! 44 | assert_equal 'def', p.main_body 45 | end 46 | 47 | test "main_body == body if body has no separator" do 48 | p = Page.new(slug: 'a_slug', page_type: 'blog_post', body: 'abcdef') 49 | p.save! 50 | assert_equal 'abcdef', p.main_body 51 | end 52 | 53 | test "still works if the body is nil" do 54 | p = Page.new(slug: 'a_slug', page_type: 'blog_post', body: nil) 55 | p.save! 56 | assert_nil p.main_body 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /test/models/user_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class UserTest < ActiveSupport::TestCase 4 | test "a user can be authenticated" do 5 | assert_equal User.authenticate(users(:horst).email, 'geheim'), users(:horst) 6 | end 7 | 8 | test "a user can NOT be authenticated with the wrong password" do 9 | assert_nil User.authenticate(users(:horst).email, 'nicht_das_passwort') 10 | end 11 | 12 | test "a users password is hashed with salt and the right format" do 13 | user = User.new(email: 'horst@mail.com', password: 'geheim') 14 | user.encrypt_password 15 | assert_match /\$2a\$12\$/, user.password_salt 16 | assert_match Regexp.new('^'+Regexp.quote(user.password_salt)), user.password_hash 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../config/environment', __dir__) 3 | require 'rails/test_help' 4 | 5 | require 'minitest/reporters' 6 | Minitest::Reporters.use!( 7 | Minitest::Reporters::SpecReporter.new, 8 | ENV, 9 | Minitest.backtrace_filter 10 | ) 11 | #Minitest::Reporters.use! # [Minitest::Reporters::DefaultReporter.new(slow_count: 5)] 12 | 13 | 14 | class ActiveSupport::TestCase 15 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 16 | fixtures :all 17 | 18 | # Add more helper methods to be used by all tests here... 19 | 20 | def valid_event_hash 21 | { 22 | title: 'New Event', 23 | date: Time.now, 24 | city: 'Some Town', 25 | country_code: 'US', 26 | main_url: 'http://www.heise.de', 27 | total: 200, 28 | woman: 10, 29 | reporter: 'hosts' 30 | } 31 | end 32 | 33 | end 34 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubymonsters/fiftypercent/4ddaa39d95898fe24874b0a4fa08a4b4e378b719/vendor/assets/stylesheets/.keep --------------------------------------------------------------------------------