├── server
├── log
│ └── .keep
├── app
│ ├── models
│ │ ├── .keep
│ │ ├── concerns
│ │ │ └── .keep
│ │ ├── day.rb
│ │ ├── room.rb
│ │ ├── topic.rb
│ │ └── admin_user.rb
│ ├── mailers
│ │ └── .keep
│ ├── assets
│ │ ├── images
│ │ │ └── .keep
│ │ ├── javascripts
│ │ │ ├── active_admin.js.coffee
│ │ │ ├── home.coffee
│ │ │ └── application.js
│ │ └── stylesheets
│ │ │ ├── home.scss
│ │ │ ├── active_admin.scss
│ │ │ └── application.css
│ ├── controllers
│ │ ├── concerns
│ │ │ └── .keep
│ │ ├── home_controller.rb
│ │ └── application_controller.rb
│ ├── helpers
│ │ ├── home_helper.rb
│ │ └── application_helper.rb
│ ├── views
│ │ ├── home
│ │ │ ├── index.html.erb
│ │ │ └── index.json.jbuilder
│ │ └── layouts
│ │ │ └── application.html.erb
│ └── admin
│ │ ├── day.rb
│ │ ├── room.rb
│ │ ├── topic.rb
│ │ ├── admin_user.rb
│ │ └── dashboard.rb
├── lib
│ ├── assets
│ │ └── .keep
│ └── tasks
│ │ ├── .keep
│ │ └── gmtc.rake
├── public
│ ├── favicon.ico
│ ├── robots.txt
│ ├── 500.html
│ ├── 422.html
│ └── 404.html
├── vendor
│ └── assets
│ │ ├── javascripts
│ │ └── .keep
│ │ └── stylesheets
│ │ └── .keep
├── Dockerfile
├── bin
│ ├── bundle
│ ├── rake
│ ├── rails
│ ├── spring
│ └── setup
├── config
│ ├── boot.rb
│ ├── initializers
│ │ ├── cookies_serializer.rb
│ │ ├── session_store.rb
│ │ ├── mime_types.rb
│ │ ├── filter_parameter_logging.rb
│ │ ├── backtrace_silencers.rb
│ │ ├── assets.rb
│ │ ├── wrap_parameters.rb
│ │ ├── inflections.rb
│ │ └── active_admin.rb
│ ├── environment.rb
│ ├── database.yml
│ ├── locales
│ │ ├── en.yml
│ │ └── devise.en.yml
│ ├── secrets.yml
│ ├── application.rb
│ ├── environments
│ │ ├── development.rb
│ │ ├── test.rb
│ │ └── production.rb
│ └── routes.rb
├── spec
│ ├── models
│ │ ├── day_spec.rb
│ │ ├── room_spec.rb
│ │ ├── topic_spec.rb
│ │ └── admin_user_spec.rb
│ ├── views
│ │ └── home
│ │ │ └── index.html.erb_spec.rb
│ ├── controllers
│ │ └── home_controller_spec.rb
│ ├── helpers
│ │ └── home_helper_spec.rb
│ ├── routing
│ │ └── days_routing_spec.rb
│ ├── rails_helper.rb
│ └── spec_helper.rb
├── config.ru
├── db
│ ├── migrate
│ │ ├── 20160623034237_create_days.rb
│ │ ├── 20160623034450_create_rooms.rb
│ │ ├── 20160623034714_create_topics.rb
│ │ ├── 20160623072040_create_active_admin_comments.rb
│ │ └── 20160623072037_devise_create_admin_users.rb
│ ├── seeds.rb
│ └── schema.rb
├── Rakefile
├── .gitignore
├── README.rdoc
├── Gemfile
├── Guardfile
└── Gemfile.lock
├── GmtcClient
├── .watchmanconfig
├── android
│ ├── settings.gradle
│ ├── app
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── res
│ │ │ │ ├── values
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ └── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── gmtcclient
│ │ │ │ └── MainActivity.java
│ │ ├── BUCK
│ │ ├── proguard-rules.pro
│ │ └── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── keystores
│ │ ├── debug.keystore.properties
│ │ └── BUCK
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradlew.bat
│ └── gradlew
├── src
│ ├── assets
│ │ ├── avatar.png
│ │ ├── gmtc.png
│ │ ├── schedule@3x.png
│ │ ├── x-white@3x.png
│ │ ├── added-cell@2x.png
│ │ ├── added-cell@3x.png
│ │ ├── hacker-way@2x.png
│ │ ├── rest-self@2x.png
│ │ ├── default_avatar.png
│ │ ├── my-g8-background.png
│ │ ├── my-schedule@3x.png
│ │ ├── no-topics-added@3x.png
│ │ ├── schedule-active@3x.png
│ │ ├── my-schedule-active@3x.png
│ │ └── schedule-background.png
│ ├── reducers
│ │ ├── index.js
│ │ ├── data.js
│ │ └── schedule.js
│ ├── helper
│ │ ├── apiRequestMiddleware.js
│ │ └── dataHelper.js
│ ├── components
│ │ ├── SegmentTabWrapper.js
│ │ ├── SubscribeButton.js
│ │ ├── Carousel.js
│ │ ├── FakeListView.js
│ │ ├── PureListView.js
│ │ ├── F8PageControl.js
│ │ ├── SegmentTab.js
│ │ ├── ViewPager.js
│ │ ├── ParallaxBackground.js
│ │ └── ListContainer.js
│ ├── App.js
│ └── pages
│ │ ├── MainScreen.js
│ │ ├── Topic.js
│ │ ├── MySchedules.js
│ │ ├── TopicDetail.js
│ │ ├── TopicsCarousel.js
│ │ └── Schedules.js
├── .buckconfig
├── index.ios.js
├── index.android.js
├── .editorconfig
├── .eslintrc
├── ios
│ ├── GmtcClient
│ │ ├── AppDelegate.h
│ │ ├── main.m
│ │ ├── Images.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ ├── Info.plist
│ │ ├── AppDelegate.m
│ │ └── Base.lproj
│ │ │ └── LaunchScreen.xib
│ ├── GmtcClientTests
│ │ ├── Info.plist
│ │ └── GmtcClientTests.m
│ └── GmtcClient.xcodeproj
│ │ └── xcshareddata
│ │ └── xcschemes
│ │ └── GmtcClient.xcscheme
├── .gitignore
├── package.json
└── .flowconfig
├── .gitignore
└── README.md
/server/log/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/app/models/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/lib/assets/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/lib/tasks/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/GmtcClient/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/server/app/mailers/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/public/favicon.ico:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/app/assets/images/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/app/models/concerns/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM rails:onbuild
2 |
--------------------------------------------------------------------------------
/server/app/helpers/home_helper.rb:
--------------------------------------------------------------------------------
1 | module HomeHelper
2 | end
3 |
--------------------------------------------------------------------------------
/server/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/server/app/assets/javascripts/active_admin.js.coffee:
--------------------------------------------------------------------------------
1 | #= require active_admin/base
2 |
--------------------------------------------------------------------------------
/server/app/models/day.rb:
--------------------------------------------------------------------------------
1 | class Day < ActiveRecord::Base
2 | has_many :rooms
3 | end
4 |
--------------------------------------------------------------------------------
/GmtcClient/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'GmtcClient'
2 |
3 | include ':app'
4 |
--------------------------------------------------------------------------------
/server/app/views/home/index.html.erb:
--------------------------------------------------------------------------------
1 |
Home#index
2 | Find me in app/views/home/index.html.erb
3 |
--------------------------------------------------------------------------------
/server/app/models/room.rb:
--------------------------------------------------------------------------------
1 | class Room < ActiveRecord::Base
2 | belongs_to :day
3 | has_many :topics
4 | end
5 |
--------------------------------------------------------------------------------
/GmtcClient/src/assets/avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/avatar.png
--------------------------------------------------------------------------------
/GmtcClient/src/assets/gmtc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/gmtc.png
--------------------------------------------------------------------------------
/GmtcClient/src/assets/schedule@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/schedule@3x.png
--------------------------------------------------------------------------------
/GmtcClient/src/assets/x-white@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/x-white@3x.png
--------------------------------------------------------------------------------
/GmtcClient/src/assets/added-cell@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/added-cell@2x.png
--------------------------------------------------------------------------------
/GmtcClient/src/assets/added-cell@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/added-cell@3x.png
--------------------------------------------------------------------------------
/GmtcClient/src/assets/hacker-way@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/hacker-way@2x.png
--------------------------------------------------------------------------------
/GmtcClient/src/assets/rest-self@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/rest-self@2x.png
--------------------------------------------------------------------------------
/GmtcClient/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | GmtcClient
3 |
4 |
--------------------------------------------------------------------------------
/GmtcClient/src/assets/default_avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/default_avatar.png
--------------------------------------------------------------------------------
/GmtcClient/src/assets/my-g8-background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/my-g8-background.png
--------------------------------------------------------------------------------
/GmtcClient/src/assets/my-schedule@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/my-schedule@3x.png
--------------------------------------------------------------------------------
/GmtcClient/src/assets/no-topics-added@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/no-topics-added@3x.png
--------------------------------------------------------------------------------
/GmtcClient/src/assets/schedule-active@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/schedule-active@3x.png
--------------------------------------------------------------------------------
/server/app/controllers/home_controller.rb:
--------------------------------------------------------------------------------
1 | class HomeController < ApplicationController
2 | def index
3 | @days = Day.all
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/GmtcClient/src/assets/my-schedule-active@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/my-schedule-active@3x.png
--------------------------------------------------------------------------------
/GmtcClient/src/assets/schedule-background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/src/assets/schedule-background.png
--------------------------------------------------------------------------------
/server/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/GmtcClient/.buckconfig:
--------------------------------------------------------------------------------
1 |
2 | [android]
3 | target = Google Inc.:Google APIs:23
4 |
5 | [maven_repositories]
6 | central = https://repo1.maven.org/maven2
7 |
--------------------------------------------------------------------------------
/GmtcClient/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/server/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2 |
3 | require 'bundler/setup' # Set up gems listed in the Gemfile.
4 |
--------------------------------------------------------------------------------
/server/spec/models/day_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Day, type: :model do
4 | pending "add some examples to (or delete) #{__FILE__}"
5 | end
6 |
--------------------------------------------------------------------------------
/server/spec/models/room_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Room, type: :model do
4 | pending "add some examples to (or delete) #{__FILE__}"
5 | end
6 |
--------------------------------------------------------------------------------
/GmtcClient/android/keystores/debug.keystore.properties:
--------------------------------------------------------------------------------
1 | key.store=debug.keystore
2 | key.alias=androiddebugkey
3 | key.store.password=android
4 | key.alias.password=android
5 |
--------------------------------------------------------------------------------
/server/app/models/topic.rb:
--------------------------------------------------------------------------------
1 | class Topic < ActiveRecord::Base
2 | belongs_to :room
3 | serialize :author_avatars, JSON
4 |
5 | default_scope {order(:start_at)}
6 | end
7 |
--------------------------------------------------------------------------------
/server/spec/models/topic_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe Topic, type: :model do
4 | pending "add some examples to (or delete) #{__FILE__}"
5 | end
6 |
--------------------------------------------------------------------------------
/GmtcClient/index.ios.js:
--------------------------------------------------------------------------------
1 | import { AppRegistry } from 'react-native'
2 | import GmtcClient from './src/App'
3 |
4 | AppRegistry.registerComponent('GmtcClient', () => GmtcClient)
5 |
--------------------------------------------------------------------------------
/GmtcClient/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/GmtcClient/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/GmtcClient/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/GmtcClient/index.android.js:
--------------------------------------------------------------------------------
1 | import { AppRegistry } from 'react-native'
2 | import GmtcClient from './src/App'
3 |
4 | AppRegistry.registerComponent('GmtcClient', () => GmtcClient)
5 |
--------------------------------------------------------------------------------
/server/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/server/spec/models/admin_user_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe AdminUser, type: :model do
4 | pending "add some examples to (or delete) #{__FILE__}"
5 | end
6 |
--------------------------------------------------------------------------------
/GmtcClient/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/applean/react-native-cx/HEAD/GmtcClient/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/server/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
4 |
--------------------------------------------------------------------------------
/server/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: '_server_session'
4 |
--------------------------------------------------------------------------------
/server/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/GmtcClient/android/keystores/BUCK:
--------------------------------------------------------------------------------
1 | keystore(
2 | name = 'debug',
3 | store = 'debug.keystore',
4 | properties = 'debug.keystore.properties',
5 | visibility = [
6 | 'PUBLIC',
7 | ],
8 | )
9 |
--------------------------------------------------------------------------------
/server/spec/views/home/index.html.erb_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe "home/index.html.erb", type: :view do
4 | pending "add some examples to (or delete) #{__FILE__}"
5 | end
6 |
--------------------------------------------------------------------------------
/server/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 |
--------------------------------------------------------------------------------
/GmtcClient/src/reducers/index.js:
--------------------------------------------------------------------------------
1 | import { combineReducers } from 'redux'
2 | import schedule from './schedule'
3 | import data from './data'
4 |
5 | export default combineReducers({
6 | schedule,
7 | data
8 | })
9 |
--------------------------------------------------------------------------------
/server/app/assets/stylesheets/home.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the home controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/GmtcClient/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 |
--------------------------------------------------------------------------------
/server/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 |
--------------------------------------------------------------------------------
/server/app/views/home/index.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.days @days do |day|
2 | json.extract! day, *day.attribute_names
3 | json.rooms day.rooms do |room|
4 | json.extract! room, *room.attribute_names
5 | json.topics room.topics
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/server/app/assets/javascripts/home.coffee:
--------------------------------------------------------------------------------
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 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/server/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 += [:password]
5 |
--------------------------------------------------------------------------------
/server/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 | end
6 |
--------------------------------------------------------------------------------
/GmtcClient/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/server/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path('../spring', __FILE__)
4 | rescue LoadError => e
5 | raise unless e.message.include?('spring')
6 | end
7 | require_relative '../config/boot'
8 | require 'rake'
9 | Rake.application.run
10 |
--------------------------------------------------------------------------------
/server/db/migrate/20160623034237_create_days.rb:
--------------------------------------------------------------------------------
1 | class CreateDays < ActiveRecord::Migration
2 | def change
3 | create_table :days do |t|
4 | t.string :name
5 | t.date :date
6 |
7 | t.timestamps null: false
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/GmtcClient/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
6 |
--------------------------------------------------------------------------------
/server/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 |
--------------------------------------------------------------------------------
/server/app/models/admin_user.rb:
--------------------------------------------------------------------------------
1 | class AdminUser < ActiveRecord::Base
2 | # Include default devise modules. Others available are:
3 | # :confirmable, :lockable, :timeoutable and :omniauthable
4 | devise :database_authenticatable,
5 | :recoverable, :rememberable, :trackable, :validatable
6 | end
7 |
--------------------------------------------------------------------------------
/server/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path('../spring', __FILE__)
4 | rescue LoadError => e
5 | raise unless e.message.include?('spring')
6 | end
7 | APP_PATH = File.expand_path('../../config/application', __FILE__)
8 | require_relative '../config/boot'
9 | require 'rails/commands'
10 |
--------------------------------------------------------------------------------
/server/spec/controllers/home_controller_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe HomeController, type: :controller do
4 |
5 | describe "GET #index" do
6 | it "returns http success" do
7 | get :index
8 | expect(response).to have_http_status(:success)
9 | end
10 | end
11 |
12 | end
13 |
--------------------------------------------------------------------------------
/server/db/migrate/20160623034450_create_rooms.rb:
--------------------------------------------------------------------------------
1 | class CreateRooms < ActiveRecord::Migration
2 | def change
3 | create_table :rooms do |t|
4 | t.references :day, index: true, foreign_key: true
5 | t.string :name
6 | t.string :description
7 | t.string :location
8 |
9 | t.timestamps null: false
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/server/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Server
5 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7 | <%= csrf_meta_tags %>
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/GmtcClient/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "parser" : "babel-eslint",
3 | "extends" : [
4 | "standard",
5 | "standard-react"
6 | ],
7 | "plugins": [
8 | "flow-vars",
9 | "react",
10 | "react-native"
11 | ],
12 | "rules": {
13 | "react-native/no-unused-styles": 2,
14 | "flow-vars/define-flow-type": 1,
15 | "flow-vars/use-flow-type": 1,
16 | "semi" : [2, "never"]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/server/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| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/server/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7 | # Mayor.create(name: 'Emanuel', city: cities.first)
8 | AdminUser.create!(email: 'admin@example.com', password: 'password', password_confirmation: 'password')
--------------------------------------------------------------------------------
/server/app/admin/day.rb:
--------------------------------------------------------------------------------
1 | ActiveAdmin.register Day do
2 |
3 | # See permitted parameters documentation:
4 | # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
5 | #
6 | # permit_params :list, :of, :attributes, :on, :model
7 | #
8 | # or
9 | #
10 | # permit_params do
11 | # permitted = [:permitted, :attributes]
12 | # permitted << :other if params[:action] == 'create' && current_user.admin?
13 | # permitted
14 | # end
15 |
16 |
17 | end
18 |
--------------------------------------------------------------------------------
/server/db/migrate/20160623034714_create_topics.rb:
--------------------------------------------------------------------------------
1 | class CreateTopics < ActiveRecord::Migration
2 | def change
3 | create_table :topics do |t|
4 | t.references :room, index: true, foreign_key: true
5 | t.string :author
6 | t.string :author_info
7 | t.string :author_avatars
8 | t.string :title
9 | t.text :description
10 | t.boolean :rest
11 | t.time :start_at
12 | t.time :end_at
13 |
14 | t.timestamps null: false
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/server/app/admin/room.rb:
--------------------------------------------------------------------------------
1 | ActiveAdmin.register Room do
2 |
3 | # See permitted parameters documentation:
4 | # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
5 | #
6 | # permit_params :list, :of, :attributes, :on, :model
7 | #
8 | # or
9 | #
10 | # permit_params do
11 | # permitted = [:permitted, :attributes]
12 | # permitted << :other if params[:action] == 'create' && current_user.admin?
13 | # permitted
14 | # end
15 |
16 |
17 | end
18 |
--------------------------------------------------------------------------------
/server/app/admin/topic.rb:
--------------------------------------------------------------------------------
1 | ActiveAdmin.register Topic do
2 |
3 | # See permitted parameters documentation:
4 | # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
5 | #
6 | # permit_params :list, :of, :attributes, :on, :model
7 | #
8 | # or
9 | #
10 | # permit_params do
11 | # permitted = [:permitted, :attributes]
12 | # permitted << :other if params[:action] == 'create' && current_user.admin?
13 | # permitted
14 | # end
15 |
16 |
17 | end
18 |
--------------------------------------------------------------------------------
/server/spec/helpers/home_helper_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | # Specs in this file have access to a helper object that includes
4 | # the HomeHelper. For example:
5 | #
6 | # describe HomeHelper do
7 | # describe "string concat" do
8 | # it "concats two strings with spaces" do
9 | # expect(helper.concat_strings("this","that")).to eq("this that")
10 | # end
11 | # end
12 | # end
13 | RSpec.describe HomeHelper, type: :helper do
14 | pending "add some examples to (or delete) #{__FILE__}"
15 | end
16 |
--------------------------------------------------------------------------------
/GmtcClient/ios/GmtcClient/AppDelegate.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 |
12 | @interface AppDelegate : UIResponder
13 |
14 | @property (nonatomic, strong) UIWindow *window;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/server/.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/*
16 | !/log/.keep
17 | /tmp
18 |
--------------------------------------------------------------------------------
/server/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 |
9 | # Precompile additional assets.
10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11 | # Rails.application.config.assets.precompile += %w( search.js )
12 |
--------------------------------------------------------------------------------
/server/bin/spring:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # This file loads spring without using Bundler, in order to be fast.
4 | # It gets overwritten when you run the `spring binstub` command.
5 |
6 | unless defined?(Spring)
7 | require 'rubygems'
8 | require 'bundler'
9 |
10 | if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
11 | Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) }
12 | gem 'spring', match[1]
13 | require 'spring/binstub'
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/GmtcClient/ios/GmtcClient/main.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 |
12 | #import "AppDelegate.h"
13 |
14 | int main(int argc, char * argv[]) {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/server/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] if respond_to?(:wrap_parameters)
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 |
--------------------------------------------------------------------------------
/server/README.rdoc:
--------------------------------------------------------------------------------
1 | == README
2 |
3 | This README would normally document whatever steps are necessary to get the
4 | application up and running.
5 |
6 | Things you may want to cover:
7 |
8 | * Ruby version
9 |
10 | * System dependencies
11 |
12 | * Configuration
13 |
14 | * Database creation
15 |
16 | * Database initialization
17 |
18 | * How to run the test suite
19 |
20 | * Services (job queues, cache servers, search engines, etc.)
21 |
22 | * Deployment instructions
23 |
24 | * ...
25 |
26 |
27 | Please feel free to use a different markup language if you do not plan to run
28 | rake doc:app.
29 |
--------------------------------------------------------------------------------
/GmtcClient/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | project.xcworkspace
24 |
25 | # Android/IJ
26 | #
27 | *.iml
28 | .idea
29 | .gradle
30 | local.properties
31 |
32 | # node.js
33 | #
34 | node_modules/
35 | npm-debug.log
36 |
37 | # BUCK
38 | buck-out/
39 | \.buckd/
40 | android/app/libs
41 | android/keystores/debug.keystore
42 |
--------------------------------------------------------------------------------
/GmtcClient/src/helper/apiRequestMiddleware.js:
--------------------------------------------------------------------------------
1 | import {genData} from './dataHelper'
2 | export default store => next => action => {
3 | const {promise, types, ...rest} = action
4 | if (!promise) {
5 | return next(action)
6 | }
7 |
8 | const [REQUEST, SUCCESS, FAILED] = types
9 | next({...rest, type: REQUEST})
10 |
11 | return promise.then(response => response.json())
12 | .then(responseData => {
13 | next({
14 | ...rest,
15 | type: SUCCESS,
16 | days: genData(responseData)
17 | })
18 | })
19 | .catch(error => next({
20 | ...rest,
21 | type: FAILED,
22 | error
23 | }))
24 | }
25 |
--------------------------------------------------------------------------------
/server/app/admin/admin_user.rb:
--------------------------------------------------------------------------------
1 | ActiveAdmin.register AdminUser do
2 | permit_params :email, :password, :password_confirmation
3 |
4 | index do
5 | selectable_column
6 | id_column
7 | column :email
8 | column :current_sign_in_at
9 | column :sign_in_count
10 | column :created_at
11 | actions
12 | end
13 |
14 | filter :email
15 | filter :current_sign_in_at
16 | filter :sign_in_count
17 | filter :created_at
18 |
19 | form do |f|
20 | f.inputs "Admin Details" do
21 | f.input :email
22 | f.input :password
23 | f.input :password_confirmation
24 | end
25 | f.actions
26 | end
27 |
28 | end
29 |
--------------------------------------------------------------------------------
/server/config/database.yml:
--------------------------------------------------------------------------------
1 | # SQLite version 3.x
2 | # gem install sqlite3
3 | #
4 | # Ensure the SQLite 3 gem is defined in your Gemfile
5 | # gem 'sqlite3'
6 | #
7 | default: &default
8 | adapter: sqlite3
9 | pool: 5
10 | timeout: 5000
11 |
12 | development:
13 | <<: *default
14 | database: db/development.sqlite3
15 |
16 | # Warning: The database defined as "test" will be erased and
17 | # re-generated from your development database when you run "rake".
18 | # Do not set this db to the same as development or production.
19 | test:
20 | <<: *default
21 | database: db/test.sqlite3
22 |
23 | production:
24 | <<: *default
25 | database: db/production.sqlite3
26 |
--------------------------------------------------------------------------------
/server/app/assets/stylesheets/active_admin.scss:
--------------------------------------------------------------------------------
1 | // SASS variable overrides must be declared before loading up Active Admin's styles.
2 | //
3 | // To view the variables that Active Admin provides, take a look at
4 | // `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the
5 | // Active Admin source.
6 | //
7 | // For example, to change the sidebar width:
8 | // $sidebar-width: 242px;
9 |
10 | // Active Admin's got SASS!
11 | @import "active_admin/mixins";
12 | @import "active_admin/base";
13 |
14 | // Overriding any non-variable SASS must be done after the fact.
15 | // For example, to change the default status-tag color:
16 | //
17 | // .status_tag { background: #6090DB; }
18 |
--------------------------------------------------------------------------------
/server/db/migrate/20160623072040_create_active_admin_comments.rb:
--------------------------------------------------------------------------------
1 | class CreateActiveAdminComments < ActiveRecord::Migration
2 | def self.up
3 | create_table :active_admin_comments do |t|
4 | t.string :namespace
5 | t.text :body
6 | t.string :resource_id, null: false
7 | t.string :resource_type, null: false
8 | t.references :author, polymorphic: true
9 | t.timestamps
10 | end
11 | add_index :active_admin_comments, [:namespace]
12 | add_index :active_admin_comments, [:author_type, :author_id]
13 | add_index :active_admin_comments, [:resource_type, :resource_id]
14 | end
15 |
16 | def self.down
17 | drop_table :active_admin_comments
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/server/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 |
--------------------------------------------------------------------------------
/server/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # To learn more, please read the Rails Internationalization guide
20 | # available at http://guides.rubyonrails.org/i18n.html.
21 |
22 | en:
23 | hello: "Hello world"
24 |
--------------------------------------------------------------------------------
/server/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 any plugin's vendor/assets/javascripts directory 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/rails/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require jquery
14 | //= require jquery_ujs
15 | //= require turbolinks
16 | //= require_tree .
17 |
--------------------------------------------------------------------------------
/GmtcClient/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.3.1'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | mavenLocal()
18 | jcenter()
19 | maven {
20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
21 | url "$rootDir/../node_modules/react-native/android"
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/server/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
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 any plugin's vendor/assets/stylesheets directory 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_tree .
14 | *= require_self
15 | */
16 |
--------------------------------------------------------------------------------
/GmtcClient/ios/GmtcClient/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/GmtcClient/ios/GmtcClientTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/server/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'pathname'
3 |
4 | # path to your application root.
5 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6 |
7 | Dir.chdir APP_ROOT do
8 | # This script is a starting point to setup your application.
9 | # Add necessary setup steps to this file:
10 |
11 | puts "== Installing dependencies =="
12 | system "gem install bundler --conservative"
13 | system "bundle check || bundle install"
14 |
15 | # puts "\n== Copying sample files =="
16 | # unless File.exist?("config/database.yml")
17 | # system "cp config/database.yml.sample config/database.yml"
18 | # end
19 |
20 | puts "\n== Preparing database =="
21 | system "bin/rake db:setup"
22 |
23 | puts "\n== Removing old logs and tempfiles =="
24 | system "rm -f log/*"
25 | system "rm -rf tmp/cache"
26 |
27 | puts "\n== Restarting application server =="
28 | system "touch tmp/restart.txt"
29 | end
30 |
--------------------------------------------------------------------------------
/GmtcClient/src/components/SegmentTabWrapper.js:
--------------------------------------------------------------------------------
1 | import React, { Component, PropTypes } from 'react'
2 | import SegmentTab from './SegmentTab'
3 | import {
4 | View
5 | } from 'react-native'
6 |
7 | export default class extends Component {
8 | static propTypes = {
9 | ...SegmentTab.propTypes,
10 | tabs: PropTypes.array,
11 | goToPage: PropTypes.func,
12 | activeTab: PropTypes.number,
13 | style: View.propTypes.style
14 | };
15 |
16 | static defaultProps = { // 返回默认的一些属性值
17 | tabs: ['One', 'Two'],
18 | activeTab: 0,
19 | goToPage () {}
20 | };
21 |
22 | render () {
23 | const {tabs, goToPage, activeTab, style} = this.props
24 |
25 | return (
26 |
27 | goToPage(index)}/>
32 |
33 | )
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/GmtcClient/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | android.useDeprecatedNdk=true
21 |
--------------------------------------------------------------------------------
/GmtcClient/src/reducers/data.js:
--------------------------------------------------------------------------------
1 | const LOAD_DATA = 'LOAD_DATA'
2 | const LOAD_DATA_SUCCESS = 'LOAD_DATA_SUCCESS'
3 | const LOAD_DATA_FAILED = 'LOAD_DATA_FAILED'
4 |
5 | const initialState = {
6 | loading: true,
7 | error: null,
8 | days: []
9 | }
10 |
11 | export default function reducer (state = initialState, action) {
12 | switch (action.type) {
13 | case LOAD_DATA:
14 | return {
15 | ...state,
16 | loading: true,
17 | error: null
18 | }
19 | case LOAD_DATA_SUCCESS:
20 | return {
21 | ...state,
22 | loading: false,
23 | error: null,
24 | days: action.days
25 | }
26 | case LOAD_DATA_FAILED:
27 | return {
28 | ...state,
29 | loading: false,
30 | error: action.error
31 | }
32 | default:
33 | return state
34 | }
35 | }
36 |
37 | export function loadData (api) {
38 | return {
39 | types: [LOAD_DATA, LOAD_DATA_SUCCESS, LOAD_DATA_FAILED],
40 | promise: fetch(api)
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.rbc
2 | capybara-*.html
3 | .rspec
4 | /log
5 | /tmp
6 | /db/*.sqlite3
7 | /db/*.sqlite3-journal
8 | /public/system
9 | /coverage/
10 | /spec/tmp
11 | **.orig
12 | rerun.txt
13 | pickle-email-*.html
14 |
15 | # TODO Comment out these rules if you are OK with secrets being uploaded to the repo
16 | config/initializers/secret_token.rb
17 | config/secrets.yml
18 |
19 | # dotenv
20 | # TODO Comment out this rule if environment variables can be committed
21 | .env
22 |
23 | ## Environment normalization:
24 | /.bundle
25 | /vendor/bundle
26 |
27 | # these should all be checked in to normalize the environment:
28 | # Gemfile.lock, .ruby-version, .ruby-gemset
29 |
30 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
31 | .rvmrc
32 |
33 | # if using bower-rails ignore default bower_components path bower.json files
34 | /vendor/assets/bower_components
35 | *.bowerrc
36 | bower.json
37 |
38 | # Ignore pow environment settings
39 | .powenv
40 |
41 | # Ignore Byebug command history file.
42 | .byebug_history
43 |
--------------------------------------------------------------------------------
/GmtcClient/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "GmtcClient",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "start": "node node_modules/react-native/local-cli/cli.js start"
7 | },
8 | "dependencies": {
9 | "react": "15.2.1",
10 | "react-native": "^0.31.0",
11 | "react-native-navigationbar": "^0.3.6",
12 | "react-native-scrollable-tab-view": "^0.5.3",
13 | "react-native-tab-navigator": "^0.3.2",
14 | "react-redux": "^4.2.0",
15 | "redux": "^3.4.0",
16 | "redux-persist": "^3.2.2",
17 | "redux-thunk": "^2.1.0",
18 | "underscore": "^1.8.3"
19 | },
20 | "devDependencies": {
21 | "babel-eslint": "^5.0.0-beta6",
22 | "eslint": "^1.10.3",
23 | "eslint-config-standard": "^4.4.0",
24 | "eslint-config-standard-react": "^1.2.1",
25 | "eslint-plugin-flow-vars": "^0.1.3",
26 | "eslint-plugin-react": "^3.15.0",
27 | "eslint-plugin-react-native": "^0.5.0",
28 | "eslint-plugin-standard": "^1.3.1",
29 | "ghooks": "^1.0.3",
30 | "node-fetch": "^1.5.2"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/server/app/admin/dashboard.rb:
--------------------------------------------------------------------------------
1 | ActiveAdmin.register_page "Dashboard" do
2 |
3 | menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") }
4 |
5 | content title: proc{ I18n.t("active_admin.dashboard") } do
6 | div class: "blank_slate_container", id: "dashboard_default_message" do
7 | span class: "blank_slate" do
8 | span I18n.t("active_admin.dashboard_welcome.welcome")
9 | small I18n.t("active_admin.dashboard_welcome.call_to_action")
10 | end
11 | end
12 |
13 | # Here is an example of a simple dashboard with columns and panels.
14 | #
15 | # columns do
16 | # column do
17 | # panel "Recent Posts" do
18 | # ul do
19 | # Post.recent(5).map do |post|
20 | # li link_to(post.title, admin_post_path(post))
21 | # end
22 | # end
23 | # end
24 | # end
25 |
26 | # column do
27 | # panel "Info" do
28 | # para "Welcome to ActiveAdmin."
29 | # end
30 | # end
31 | # end
32 | end # content
33 | end
34 |
--------------------------------------------------------------------------------
/server/config/secrets.yml:
--------------------------------------------------------------------------------
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: 0302247c9e57dba863dd7b5090df4f34ec901c9b2904eed39052a0fe491ef3db37389a640ad300e4aaa9ff8e51ba49f56689a6218510060426bc036a5fad370b
15 |
16 | test:
17 | secret_key_base: 1ebef8a4ff91c9a123000f8a811d91dfa3affd998d284f33debf31e01cea0398898a1827580314c98b1d1e1ab2fddb4d7d521c81eaf47befed2899c3ac774eea
18 |
19 | # Do not keep production secrets in the repository,
20 | # instead read values from the environment.
21 | production:
22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
23 |
--------------------------------------------------------------------------------
/server/spec/routing/days_routing_spec.rb:
--------------------------------------------------------------------------------
1 | require "rails_helper"
2 |
3 | RSpec.describe DaysController, type: :routing do
4 | describe "routing" do
5 |
6 | it "routes to #index" do
7 | expect(:get => "/days").to route_to("days#index")
8 | end
9 |
10 | it "routes to #new" do
11 | expect(:get => "/days/new").to route_to("days#new")
12 | end
13 |
14 | it "routes to #show" do
15 | expect(:get => "/days/1").to route_to("days#show", :id => "1")
16 | end
17 |
18 | it "routes to #edit" do
19 | expect(:get => "/days/1/edit").to route_to("days#edit", :id => "1")
20 | end
21 |
22 | it "routes to #create" do
23 | expect(:post => "/days").to route_to("days#create")
24 | end
25 |
26 | it "routes to #update via PUT" do
27 | expect(:put => "/days/1").to route_to("days#update", :id => "1")
28 | end
29 |
30 | it "routes to #update via PATCH" do
31 | expect(:patch => "/days/1").to route_to("days#update", :id => "1")
32 | end
33 |
34 | it "routes to #destroy" do
35 | expect(:delete => "/days/1").to route_to("days#destroy", :id => "1")
36 | end
37 |
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/GmtcClient/src/components/SubscribeButton.js:
--------------------------------------------------------------------------------
1 | import React, {Component, PropTypes} from 'react'
2 | import {
3 | Text,
4 | StyleSheet,
5 | View,
6 | TouchableOpacity
7 | } from 'react-native'
8 |
9 | export default class extends Component {
10 |
11 | static propTypes={
12 | isSubscribed: PropTypes.bool,
13 | onPress: PropTypes.func,
14 | message: PropTypes.string,
15 | style: View.propTypes.style
16 | };
17 |
18 | static defaultProps={
19 | onPress () {}
20 | }
21 |
22 | render () {
23 | const {isSubscribed, onPress, style} = this.props
24 | const promptMessage = this.props.message || isSubscribed ? '取消订阅' : '订 阅'
25 | const color = isSubscribed ? '#4DC7A4' : '#6A6AD5'
26 | return (
27 |
28 | {promptMessage}
29 |
30 | )
31 | }
32 | }
33 |
34 | const styles = StyleSheet.create({
35 | button: {
36 | height: 40,
37 | marginTop: 10,
38 | borderRadius: 20,
39 | alignItems: 'center',
40 | justifyContent: 'center'
41 | }
42 | })
43 |
--------------------------------------------------------------------------------
/GmtcClient/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
12 |
13 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/GmtcClient/src/components/Carousel.js:
--------------------------------------------------------------------------------
1 | import React, {PropTypes, Component} from 'react'
2 | import ViewPager from './ViewPager'
3 | import {
4 | StyleSheet
5 | } from 'react-native'
6 |
7 | /*
8 | * 本质就是一个只显示3个内容的ViewPager
9 | */
10 | export default class extends Component {
11 | static propTypes = {
12 | count: PropTypes.number,
13 | selectedIndex: PropTypes.number,
14 | onSelectedIndexChange: PropTypes.func,
15 | renderCard: PropTypes.func,
16 | style: PropTypes.any
17 | };
18 |
19 | render () {
20 | let cards = []
21 | const {count, selectedIndex, renderCard} = this.props
22 |
23 | for (let i = 0; i < count; i++) {
24 | let content = null
25 | if (Math.abs(i - selectedIndex) < 2) { // 只渲染当前页面以及左右共计3个View
26 | content = renderCard(i)
27 | }
28 | cards.push(content)
29 | }
30 | return (
31 |
32 | {cards}
33 |
34 | )
35 | }
36 | }
37 |
38 | // overflow是一个对子组件在屏幕外时性能相关的属性
39 | var styles = StyleSheet.create({
40 | carousel: {
41 | margin: 10,
42 | marginTop: 5,
43 | overflow: 'visible',
44 | backgroundColor: '#6ec0df'
45 | }
46 | })
47 |
--------------------------------------------------------------------------------
/GmtcClient/android/app/src/main/java/com/gmtcclient/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.gmtcclient;
2 |
3 | import com.facebook.react.ReactActivity;
4 | import com.facebook.react.ReactPackage;
5 | import com.facebook.react.shell.MainReactPackage;
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | public class MainActivity extends ReactActivity {
11 |
12 | /**
13 | * Returns the name of the main component registered from JavaScript.
14 | * This is used to schedule rendering of the component.
15 | */
16 | @Override
17 | protected String getMainComponentName() {
18 | return "GmtcClient";
19 | }
20 |
21 | /**
22 | * Returns whether dev mode should be enabled.
23 | * This enables e.g. the dev menu.
24 | */
25 | @Override
26 | protected boolean getUseDeveloperSupport() {
27 | return BuildConfig.DEBUG;
28 | }
29 |
30 | /**
31 | * A list of packages used by the app. If the app uses additional views
32 | * or modules besides the default ones, add more packages here.
33 | */
34 | @Override
35 | protected List getPackages() {
36 | return Arrays.asList(
37 | new MainReactPackage()
38 | );
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CX (version for Android is coming)
2 | Made for conference schedule
3 | ## Preview
4 |
5 | ### Home
6 |
7 |
8 |
9 | ### Detail
10 |
11 |
12 |
13 |
14 | # Usage
15 | 1. The repository contains parts for server and react native client, you can pay your attention to codes in client named 'GmtcClient' after cloning.
16 | 2. `cd GmtcClient`
17 | 3. `npm install` install required libraries
18 | 4. `react-native run-ios` of course, you need OSX system to run ios.
19 | If possible, please go [here](https://applean.cn). It could be easier to program react-native on the [site](https://applean.cn).
20 |
21 | **If you encounter some problems while experiencing cx, just contact me for help or [create issues](https://github.com/applean/gmtc/issues) in this repository.**
22 |
23 | *Thanks for parts of design and special components from F8*
24 |
25 | #License
26 | *BSD*
27 | as commercial value, only used for learning not business activity
28 |
--------------------------------------------------------------------------------
/server/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require "rails"
4 | # Pick the frameworks you want:
5 | require "active_model/railtie"
6 | require "active_job/railtie"
7 | require "active_record/railtie"
8 | require "action_controller/railtie"
9 | require "action_mailer/railtie"
10 | require "action_view/railtie"
11 | require "sprockets/railtie"
12 | # require "rails/test_unit/railtie"
13 |
14 | # Require the gems listed in Gemfile, including any gems
15 | # you've limited to :test, :development, or :production.
16 | Bundler.require(*Rails.groups)
17 |
18 | module Server
19 | class Application < Rails::Application
20 | # Settings in config/environments/* take precedence over those specified here.
21 | # Application configuration should go into files in config/initializers
22 | # -- all .rb files in that directory are automatically loaded.
23 |
24 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26 | # config.time_zone = 'Central Time (US & Canada)'
27 |
28 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30 | # config.i18n.default_locale = :de
31 |
32 | # Do not swallow errors in after_commit/after_rollback callbacks.
33 | config.active_record.raise_in_transactional_callbacks = true
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/server/db/migrate/20160623072037_devise_create_admin_users.rb:
--------------------------------------------------------------------------------
1 | class DeviseCreateAdminUsers < ActiveRecord::Migration
2 | def change
3 | create_table(:admin_users) do |t|
4 | ## Database authenticatable
5 | t.string :email, null: false, default: ""
6 | t.string :encrypted_password, null: false, default: ""
7 |
8 | ## Recoverable
9 | t.string :reset_password_token
10 | t.datetime :reset_password_sent_at
11 |
12 | ## Rememberable
13 | t.datetime :remember_created_at
14 |
15 | ## Trackable
16 | t.integer :sign_in_count, default: 0, null: false
17 | t.datetime :current_sign_in_at
18 | t.datetime :last_sign_in_at
19 | t.string :current_sign_in_ip
20 | t.string :last_sign_in_ip
21 |
22 | ## Confirmable
23 | # t.string :confirmation_token
24 | # t.datetime :confirmed_at
25 | # t.datetime :confirmation_sent_at
26 | # t.string :unconfirmed_email # Only if using reconfirmable
27 |
28 | ## Lockable
29 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30 | # t.string :unlock_token # Only if unlock strategy is :email or :both
31 | # t.datetime :locked_at
32 |
33 |
34 | t.timestamps null: false
35 | end
36 |
37 | add_index :admin_users, :email, unique: true
38 | add_index :admin_users, :reset_password_token, unique: true
39 | # add_index :admin_users, :confirmation_token, unique: true
40 | # add_index :admin_users, :unlock_token, unique: true
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/GmtcClient/src/components/FakeListView.js:
--------------------------------------------------------------------------------
1 | import React, { Component, PropTypes } from 'react'
2 | import {
3 | View,
4 | ScrollView,
5 | StyleSheet
6 | } from 'react-native'
7 |
8 | export default class extends Component {
9 |
10 | static propTypes = {
11 | data: PropTypes.object,
12 | needSeparator: PropTypes.bool,
13 | renderRow: PropTypes.func,
14 | renderSectionHeader: PropTypes.func,
15 | renderEmptyView: PropTypes.func
16 | };
17 |
18 | static defaultProps = {
19 | needSeparator: true
20 | }
21 |
22 | render () {
23 | const {data, renderEmptyView} = this.props
24 | let length = 0
25 | for (let day in this.props.data) {
26 | length += data[day].length
27 | }
28 | return (
29 | length > 0
30 | ?
31 | {this.renderContent()}
32 |
33 | : renderEmptyView()
34 | )
35 | }
36 |
37 | renderContent () {
38 | const {data, renderRow, renderSectionHeader} = this.props
39 | let result = []
40 | for (let item in data) {
41 | let sectionView = (
42 |
43 | {[
44 | renderSectionHeader(data[item], item),
45 | data[item].map((row, index) => renderRow(row, index, this.renderSeparator))
46 | ]}
47 |
48 | )
49 | result.push(sectionView)
50 | }
51 | return result
52 | }
53 |
54 | renderSeparator = (row, index) =>
55 |
56 |
57 | }
58 |
59 | const styles = StyleSheet.create({
60 | separator: {
61 | height: 1,
62 | backgroundColor: '#eee'
63 | }
64 | })
65 |
--------------------------------------------------------------------------------
/server/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 |
--------------------------------------------------------------------------------
/GmtcClient/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react'
2 | import reducers from './reducers'
3 | import thunk from 'redux-thunk'
4 | import {Provider} from 'react-redux'
5 | import {persistStore, autoRehydrate} from 'redux-persist'
6 | import {createStore, applyMiddleware} from 'redux'
7 | import {AsyncStorage} from 'react-native'
8 | import apiRequest from './helper/apiRequestMiddleware'
9 | import Home from './pages/MainScreen'
10 |
11 | const createStoreWithMiddleware = applyMiddleware(thunk, apiRequest)(createStore)
12 |
13 | const store = autoRehydrate()(createStoreWithMiddleware)(reducers)
14 | persistStore(store, {storage: AsyncStorage})
15 | import {
16 | Platform,
17 | StatusBar,
18 | View,
19 | Navigator
20 | } from 'react-native'
21 |
22 | export const STATUS_BAR_HEIGHT = (Platform.OS === 'ios' ? 20 : 25)
23 | export const NAV_BAR_HEIGHT = (Platform.OS === 'ios' ? 44 : 56)
24 | export const ABOVE_LOLIPOP = Platform.Version && Platform.Version > 19
25 |
26 | export default class extends Component {
27 | render () {
28 | return (
29 |
30 |
31 |
37 | Navigator.SceneConfigs.FloatFromBottom}
42 | renderScene={(route, navigator) => {
43 | return
44 | }}/>
45 |
46 |
47 | )
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/server/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
11 |
12 | # Show full error reports and disable caching.
13 | config.consider_all_requests_local = true
14 | config.action_controller.perform_caching = false
15 |
16 | # Don't care if the mailer can't send.
17 | config.action_mailer.raise_delivery_errors = false
18 |
19 | # Print deprecation notices to the Rails logger.
20 | config.active_support.deprecation = :log
21 |
22 | # Raise an error on page load if there are pending migrations.
23 | config.active_record.migration_error = :page_load
24 |
25 | # Debug mode disables concatenation and preprocessing of assets.
26 | # This option may cause significant delays in view rendering with a large
27 | # number of complex assets.
28 | config.assets.debug = true
29 |
30 | # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31 | # yet still be able to expire them through the digest params.
32 | config.assets.digest = true
33 |
34 | # Adds additional error checking when serving assets at runtime.
35 | # Checks for improperly declared sprockets dependencies.
36 | # Raises helpful error messages.
37 | config.assets.raise_runtime_errors = true
38 |
39 | # Raises error for missing translations
40 | # config.action_view.raise_on_missing_translations = true
41 | end
42 |
--------------------------------------------------------------------------------
/GmtcClient/android/app/BUCK:
--------------------------------------------------------------------------------
1 | import re
2 |
3 | # To learn about Buck see [Docs](https://buckbuild.com/).
4 | # To run your application with Buck:
5 | # - install Buck
6 | # - `npm start` - to start the packager
7 | # - `cd android`
8 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US`
9 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
10 | # - `buck install -r android/app` - compile, install and run application
11 | #
12 |
13 | lib_deps = []
14 | for jarfile in glob(['libs/*.jar']):
15 | name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile)
16 | lib_deps.append(':' + name)
17 | prebuilt_jar(
18 | name = name,
19 | binary_jar = jarfile,
20 | )
21 |
22 | for aarfile in glob(['libs/*.aar']):
23 | name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile)
24 | lib_deps.append(':' + name)
25 | android_prebuilt_aar(
26 | name = name,
27 | aar = aarfile,
28 | )
29 |
30 | android_library(
31 | name = 'all-libs',
32 | exported_deps = lib_deps
33 | )
34 |
35 | android_library(
36 | name = 'app-code',
37 | srcs = glob([
38 | 'src/main/java/**/*.java',
39 | ]),
40 | deps = [
41 | ':all-libs',
42 | ':build_config',
43 | ':res',
44 | ],
45 | )
46 |
47 | android_build_config(
48 | name = 'build_config',
49 | package = 'com.gmtcclient',
50 | )
51 |
52 | android_resource(
53 | name = 'res',
54 | res = 'src/main/res',
55 | package = 'com.gmtcclient',
56 | )
57 |
58 | android_binary(
59 | name = 'app',
60 | package_type = 'debug',
61 | manifest = 'src/main/AndroidManifest.xml',
62 | keystore = '//android/keystores:debug',
63 | deps = [
64 | ':app-code',
65 | ],
66 | )
67 |
--------------------------------------------------------------------------------
/GmtcClient/ios/GmtcClient/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UIViewControllerBasedStatusBarAppearance
38 |
39 | NSLocationWhenInUseUsageDescription
40 |
41 | NSAppTransportSecurity
42 |
43 | NSAllowsArbitraryLoads
44 |
45 | NSExceptionDomains
46 |
47 | localhost
48 |
49 | NSTemporaryExceptionAllowsInsecureHTTPLoads
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/server/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 |
4 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5 | gem 'rails', '4.2.6'
6 | # Use sqlite3 as the database for Active Record
7 | gem 'sqlite3'
8 | # Use SCSS for stylesheets
9 | gem 'sass-rails', '~> 5.0'
10 | # Use Uglifier as compressor for JavaScript assets
11 | gem 'uglifier', '>= 1.3.0'
12 | # Use CoffeeScript for .coffee assets and views
13 | gem 'coffee-rails', '~> 4.1.0'
14 | # See https://github.com/rails/execjs#readme for more supported runtimes
15 | # gem 'therubyracer', platforms: :ruby
16 |
17 | # Use jquery as the JavaScript library
18 | gem 'jquery-rails'
19 | # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
20 | gem 'turbolinks'
21 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
22 | gem 'jbuilder', '~> 2.0'
23 | # bundle exec rake doc:rails generates the API under doc/api.
24 | gem 'sdoc', '~> 0.4.0', group: :doc
25 | gem 'rspec-rails'
26 | gem 'hpricot'
27 | gem 'devise'
28 | gem 'activeadmin', github: 'activeadmin'
29 |
30 | # Use ActiveModel has_secure_password
31 | # gem 'bcrypt', '~> 3.1.7'
32 |
33 | # Use Unicorn as the app server
34 | # gem 'unicorn'
35 |
36 | # Use Capistrano for deployment
37 | # gem 'capistrano-rails', group: :development
38 |
39 | group :development, :test do
40 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console
41 | gem 'byebug'
42 | gem 'guard-rspec', require: false
43 | end
44 |
45 | group :development do
46 | # Access an IRB console on exception pages or by using <%= console %> in views
47 | gem 'web-console', '~> 2.0'
48 |
49 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
50 | gem 'spring'
51 | end
52 |
53 |
--------------------------------------------------------------------------------
/server/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 |
--------------------------------------------------------------------------------
/server/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 |
--------------------------------------------------------------------------------
/GmtcClient/src/helper/dataHelper.js:
--------------------------------------------------------------------------------
1 | export function genData (data) {
2 | return data.days.map(day => {
3 | let topicTimeMap = {}
4 | day.rooms.forEach(room => {
5 | const {topics, ...others} = room
6 | topics.forEach(topic => {
7 | if (!topicTimeMap[topic.start_at]) {
8 | topicTimeMap[topic.start_at] = []
9 | }
10 | if (!(topic.rest && topicTimeMap[topic.start_at].length === 1)) {
11 | topic.room = {...others}
12 | topic.isSubscribed = false
13 | topicTimeMap[topic.start_at].push(topic)
14 | }
15 | })
16 | })
17 | day.topics = topicTimeMap
18 | delete day.rooms
19 | return day
20 | })
21 | }
22 |
23 | /*
24 | * 潜在Bug: 组合数据时,一定要返回一个新的对象。(days是一个不可变的源数据)
25 | * 否则,第一次调用,ListView接收到的是被修改了的原始数据。后期则是一直使用对原始数据的修改。
26 | * 因此,在每次调用的时候,一定要返回一个新的对象,以供ListView的WillReceiveProps做对比
27 | */
28 | export function combineData (days, subscription) {
29 | return days.map(day => {
30 | const newTopics = {}
31 | for (let sectionID in day.topics) {
32 | let section = day.topics[sectionID].map(
33 | topic => ({
34 | ...topic,
35 | isSubscribed: subscription.indexOf(topic.id) > -1
36 | })
37 | )
38 | newTopics[sectionID] = section
39 | }
40 | return {...day, topics: newTopics}
41 | })
42 | }
43 |
44 | // [{..., topics: {1: [], 2: []}}, {}]
45 | export function genSubscribedData (days, subscription) {
46 | let result = {}
47 | days.forEach(day => {
48 | for (let sectionID in day.topics) {
49 | day.topics[sectionID].forEach(topic => {
50 | if (subscription.indexOf(topic.id) > -1) {
51 | if (!result[day.id]) {
52 | result[day.id] = []
53 | }
54 | result[day.id].push(topic)
55 | }
56 | })
57 | }
58 | })
59 | return result
60 | }
61 |
--------------------------------------------------------------------------------
/server/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure static file server for tests with Cache-Control for performance.
16 | config.serve_static_files = true
17 | config.static_cache_control = 'public, max-age=3600'
18 |
19 | # Show full error reports and disable caching.
20 | config.consider_all_requests_local = true
21 | config.action_controller.perform_caching = false
22 |
23 | # Raise exceptions instead of rendering exception templates.
24 | config.action_dispatch.show_exceptions = false
25 |
26 | # Disable request forgery protection in test environment.
27 | config.action_controller.allow_forgery_protection = false
28 |
29 | # Tell Action Mailer not to deliver emails to the real world.
30 | # The :test delivery method accumulates sent emails in the
31 | # ActionMailer::Base.deliveries array.
32 | config.action_mailer.delivery_method = :test
33 |
34 | # Randomize the order test cases are executed.
35 | config.active_support.test_order = :random
36 |
37 | # Print deprecation notices to the stderr.
38 | config.active_support.deprecation = :stderr
39 |
40 | # Raises error for missing translations
41 | # config.action_view.raise_on_missing_translations = true
42 | end
43 |
--------------------------------------------------------------------------------
/server/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | devise_for :admin_users, ActiveAdmin::Devise.config
3 | ActiveAdmin.routes(self)
4 | get 'home/index'
5 |
6 | # The priority is based upon order of creation: first created -> highest priority.
7 | # See how all your routes lay out with "rake routes".
8 |
9 | # You can have the root of your site routed with "root"
10 | # root 'welcome#index'
11 |
12 | # Example of regular route:
13 | # get 'products/:id' => 'catalog#view'
14 |
15 | # Example of named route that can be invoked with purchase_url(id: product.id)
16 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
17 |
18 | # Example resource route (maps HTTP verbs to controller actions automatically):
19 | # resources :products
20 |
21 | # Example resource route with options:
22 | # resources :products do
23 | # member do
24 | # get 'short'
25 | # post 'toggle'
26 | # end
27 | #
28 | # collection do
29 | # get 'sold'
30 | # end
31 | # end
32 |
33 | # Example resource route with sub-resources:
34 | # resources :products do
35 | # resources :comments, :sales
36 | # resource :seller
37 | # end
38 |
39 | # Example resource route with more complex sub-resources:
40 | # resources :products do
41 | # resources :comments
42 | # resources :sales do
43 | # get 'recent', on: :collection
44 | # end
45 | # end
46 |
47 | # Example resource route with concerns:
48 | # concern :toggleable do
49 | # post 'toggle'
50 | # end
51 | # resources :posts, concerns: :toggleable
52 | # resources :photos, concerns: :toggleable
53 |
54 | # Example resource route within a namespace:
55 | # namespace :admin do
56 | # # Directs /admin/products/* to Admin::ProductsController
57 | # # (app/controllers/admin/products_controller.rb)
58 | # resources :products
59 | # end
60 | end
61 |
--------------------------------------------------------------------------------
/GmtcClient/src/pages/MainScreen.js:
--------------------------------------------------------------------------------
1 | import React, {PropTypes} from 'react'
2 | import TabNavigator from 'react-native-tab-navigator'
3 | import MySchedules from './MySchedules'
4 | import Schedules from './Schedules'
5 |
6 | import {
7 | Image,
8 | StyleSheet
9 | } from 'react-native'
10 |
11 | export default class extends React.Component {
12 | static propTypes = {
13 | navigator: PropTypes.object,
14 | user: PropTypes.object
15 | };
16 |
17 | state={
18 | selectedTab: 'schedules'
19 | }
20 |
21 | render () {
22 | return (
23 |
24 | }
29 | renderSelectedIcon={() => }
30 | onPress={() => this.setState({ selectedTab: 'schedules' })}>
31 |
32 |
33 | }
38 | renderSelectedIcon={() => }
39 | onPress={() => this.setState({ selectedTab: 'mySchedules' })}>
40 |
41 |
42 |
43 | )
44 | }
45 |
46 | goHome = () => {
47 | this.setState({
48 | selectedTab: 'schedules'
49 | })
50 | }
51 | }
52 |
53 | const styles = StyleSheet.create({
54 | icon: {
55 | height: 27,
56 | width: 26
57 | }
58 | })
59 |
--------------------------------------------------------------------------------
/GmtcClient/src/pages/Topic.js:
--------------------------------------------------------------------------------
1 | import React, { Component, PropTypes } from 'react'
2 |
3 | import {
4 | View,
5 | Text,
6 | StyleSheet,
7 | Image
8 | } from 'react-native'
9 |
10 | export default class extends Component {
11 | static propTypes = {
12 | topic: PropTypes.object,
13 | style: View.propTypes.style,
14 | isSubscribed: PropTypes.bool
15 | };
16 |
17 | static defaultProps = {
18 | isSubscribed: false
19 | }
20 |
21 | render () {
22 | const {topic, style, isSubscribed} = this.props
23 | return (
24 |
25 | {topic.title}
26 | {
27 | topic.author &&
28 |
29 | {
30 | topic.author_avatars.length > 0
31 | ? topic.author_avatars.map((uri, index) =>
32 |
33 | )
34 | :
35 | }
36 |
37 | {topic.author}
38 | {topic.author_info}
39 |
40 |
41 | }
42 | {isSubscribed &&
43 |
44 | }
45 |
46 | )
47 | }
48 | }
49 |
50 | const styles = StyleSheet.create({
51 | font: {
52 | fontSize: 12.5,
53 | color: '#555555'
54 | },
55 | subscribedLabel: {
56 | height: 30,
57 | width: 30,
58 | position: 'absolute',
59 | top: 0,
60 | right: 0
61 | }
62 | })
63 |
--------------------------------------------------------------------------------
/GmtcClient/src/reducers/schedule.js:
--------------------------------------------------------------------------------
1 | const SUBSCRIBE = 'SUBSCRIBE'
2 | const SUBSCRIBE_SUCCESS = 'SUBSCRIBE_SUCCESS'
3 | const SUBSCRIBE_FAILED = 'SUBSCRIBE_FAILED'
4 | const UNSUBSCRIBE = 'UNSUBSCRIBE'
5 | const UNSUBSCRIBE_SUCCESS = 'UNSUBSCRIBE_SUCCESS'
6 | const UNSUBSCRIBE_FAILED = 'UNSUBSCRIBE_FAILED'
7 |
8 | const initialState = {
9 | subscribing: true,
10 | error: null,
11 | subscription: []
12 | }
13 |
14 | export default function reducer (state = initialState, action) {
15 | switch (action.type) {
16 | case SUBSCRIBE:
17 | return {
18 | ...state,
19 | subscription: [
20 | ...state.subscription,
21 | action.id
22 | ],
23 | error: null
24 | }
25 | case SUBSCRIBE_SUCCESS:
26 | return {
27 | ...state,
28 | subscribing: false,
29 | error: null
30 | }
31 | case SUBSCRIBE_FAILED:
32 | return {
33 | ...state,
34 | subscribing: false,
35 | error: action.error
36 | }
37 | case UNSUBSCRIBE:
38 | return {
39 | ...state,
40 | subscription: state.subscription.filter(item => item !== action.id),
41 | error: null
42 | }
43 | case UNSUBSCRIBE_SUCCESS:
44 | return {
45 | ...state,
46 | subscribing: false,
47 | error: null
48 | }
49 | case UNSUBSCRIBE_FAILED:
50 | return {
51 | ...state,
52 | subscribing: false,
53 | error: action.error
54 | }
55 | default:
56 | return state
57 | }
58 | }
59 |
60 | export function subscribe (id) {
61 | return {
62 | type: SUBSCRIBE,
63 | id
64 | }
65 | }
66 |
67 | export function subscribeSuccess () {
68 | return {
69 | type: SUBSCRIBE_SUCCESS
70 | }
71 | }
72 |
73 | export function subscribeFailed (error) {
74 | return {
75 | type: SUBSCRIBE_FAILED,
76 | error
77 | }
78 | }
79 |
80 | export function unsubscribe (id) {
81 | return {
82 | type: UNSUBSCRIBE,
83 | id
84 | }
85 | }
86 |
87 | export function unsubscribeSuccess () {
88 | return {
89 | type: UNSUBSCRIBE_SUCCESS
90 | }
91 | }
92 |
93 | export function unsubscribeFailed (error) {
94 | return {
95 | type: UNSUBSCRIBE_FAILED,
96 | error
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/GmtcClient/ios/GmtcClientTests/GmtcClientTests.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 | #import
12 |
13 | #import "RCTLog.h"
14 | #import "RCTRootView.h"
15 |
16 | #define TIMEOUT_SECONDS 600
17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
18 |
19 | @interface GmtcClientTests : XCTestCase
20 |
21 | @end
22 |
23 | @implementation GmtcClientTests
24 |
25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
26 | {
27 | if (test(view)) {
28 | return YES;
29 | }
30 | for (UIView *subview in [view subviews]) {
31 | if ([self findSubviewInView:subview matching:test]) {
32 | return YES;
33 | }
34 | }
35 | return NO;
36 | }
37 |
38 | - (void)testRendersWelcomeScreen
39 | {
40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
42 | BOOL foundElement = NO;
43 |
44 | __block NSString *redboxError = nil;
45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
46 | if (level >= RCTLogLevelError) {
47 | redboxError = message;
48 | }
49 | });
50 |
51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
54 |
55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
57 | return YES;
58 | }
59 | return NO;
60 | }];
61 | }
62 |
63 | RCTSetLogFunction(RCTDefaultLogFunction);
64 |
65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
67 | }
68 |
69 |
70 | @end
71 |
--------------------------------------------------------------------------------
/GmtcClient/ios/GmtcClient/AppDelegate.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import "AppDelegate.h"
11 |
12 | #import "RCTRootView.h"
13 |
14 | @implementation AppDelegate
15 |
16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
17 | {
18 | NSURL *jsCodeLocation;
19 |
20 | /**
21 | * Loading JavaScript code - uncomment the one you want.
22 | *
23 | * OPTION 1
24 | * Load from development server. Start the server from the repository root:
25 | *
26 | * $ npm start
27 | *
28 | * To run on device, change `localhost` to the IP address of your computer
29 | * (you can get this by typing `ifconfig` into the terminal and selecting the
30 | * `inet` value under `en0:`) and make sure your computer and iOS device are
31 | * on the same Wi-Fi network.
32 | */
33 |
34 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
35 |
36 | /**
37 | * OPTION 2
38 | * Load from pre-bundled file on disk. The static bundle is automatically
39 | * generated by the "Bundle React Native code and images" build step when
40 | * running the project on an actual device or running the project on the
41 | * simulator in the "Release" build configuration.
42 | */
43 |
44 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
45 |
46 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
47 | moduleName:@"GmtcClient"
48 | initialProperties:nil
49 | launchOptions:launchOptions];
50 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
51 |
52 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
53 | UIViewController *rootViewController = [UIViewController new];
54 | rootViewController.view = rootView;
55 | self.window.rootViewController = rootViewController;
56 | [self.window makeKeyAndVisible];
57 | return YES;
58 | }
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/GmtcClient/src/components/PureListView.js:
--------------------------------------------------------------------------------
1 | import React, { Component, PropTypes } from 'react'
2 | import {
3 | View,
4 | ListView,
5 | StyleSheet
6 | } from 'react-native'
7 |
8 | const dataSource = new ListView.DataSource({
9 | getRowData: (dataBlob, sid, rid) => dataBlob[sid][rid],
10 | getSectionHeaderData: (dataBlob, sid) => dataBlob[sid],
11 | rowHasChanged: (row1, row2) => row1 !== row2,
12 | sectionHeaderHasChanged: (s1, s2) => s1 !== s2
13 | })
14 |
15 | export default class extends Component {
16 |
17 | static propTypes = {
18 | data: PropTypes.any,
19 | needSeparator: PropTypes.bool,
20 | renderEmptyView: PropTypes.func
21 | };
22 |
23 | static defaultProps = {
24 | needSeparator: true
25 | }
26 |
27 | constructor (props) {
28 | super(props)
29 | this.length = 0
30 | this.state = {
31 | dataSource: this.cloneWithData(dataSource, props.data)
32 | }
33 | }
34 |
35 | componentWillReceiveProps (nextProps) {
36 | if (this.props.data !== nextProps.data) {
37 | this.setState({
38 | dataSource: this.cloneWithData(this.state.dataSource, nextProps.data)
39 | })
40 | }
41 | }
42 |
43 | render () {
44 | const {renderEmptyView} = this.props
45 | return (
46 | this.length > 0
47 | ?
56 | : renderEmptyView()
57 | )
58 | }
59 |
60 | scrollTo (...args: Array) {
61 | this.refs.listview.scrollTo(...args)
62 | }
63 |
64 | getScrollResponder (): any {
65 | return this.refs.listview.getScrollResponder()
66 | }
67 |
68 | cloneWithData (dataSource, data) {
69 | if (!data) {
70 | this.length = 0
71 | return dataSource.cloneWithRows([])
72 | }
73 | if (Array.isArray(data)) {
74 | this.length = data.length
75 | return dataSource.cloneWithRows(data)
76 | }
77 | this.length = 0
78 | for (let day in data) {
79 | this.length += data[day].length
80 | }
81 | return dataSource.cloneWithRowsAndSections(data)
82 | }
83 |
84 | renderSeparator = (sectionID, rowID) =>
85 | this.props.needSeparator &&
86 |
87 | }
88 |
89 | const styles = StyleSheet.create({
90 | separator: {
91 | height: 1,
92 | backgroundColor: '#eee'
93 | }
94 | })
95 |
--------------------------------------------------------------------------------
/server/Guardfile:
--------------------------------------------------------------------------------
1 | # A sample Guardfile
2 | # More info at https://github.com/guard/guard#readme
3 |
4 | ## Uncomment and set this to only include directories you want to watch
5 | # directories %w(app lib config test spec features) \
6 | # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7 |
8 | ## Note: if you are using the `directories` clause above and you are not
9 | ## watching the project directory ('.'), then you will want to move
10 | ## the Guardfile to a watched dir and symlink it back, e.g.
11 | #
12 | # $ mkdir config
13 | # $ mv Guardfile config/
14 | # $ ln -s config/Guardfile .
15 | #
16 | # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17 |
18 | # Note: The cmd option is now required due to the increasing number of ways
19 | # rspec may be run, below are examples of the most common uses.
20 | # * bundler: 'bundle exec rspec'
21 | # * bundler binstubs: 'bin/rspec'
22 | # * spring: 'bin/rspec' (This will use spring if running and you have
23 | # installed the spring binstubs per the docs)
24 | # * zeus: 'zeus rspec' (requires the server to be started separately)
25 | # * 'just' rspec: 'rspec'
26 |
27 | guard :rspec, cmd: "bundle exec rspec" do
28 | require "guard/rspec/dsl"
29 | dsl = Guard::RSpec::Dsl.new(self)
30 |
31 | # Feel free to open issues for suggestions and improvements
32 |
33 | # RSpec files
34 | rspec = dsl.rspec
35 | watch(rspec.spec_helper) { rspec.spec_dir }
36 | watch(rspec.spec_support) { rspec.spec_dir }
37 | watch(rspec.spec_files)
38 |
39 | # Ruby files
40 | ruby = dsl.ruby
41 | dsl.watch_spec_files_for(ruby.lib_files)
42 |
43 | # Rails files
44 | rails = dsl.rails(view_extensions: %w(erb haml slim))
45 | dsl.watch_spec_files_for(rails.app_files)
46 | dsl.watch_spec_files_for(rails.views)
47 |
48 | watch(rails.controllers) do |m|
49 | [
50 | rspec.spec.call("routing/#{m[1]}_routing"),
51 | rspec.spec.call("controllers/#{m[1]}_controller"),
52 | rspec.spec.call("acceptance/#{m[1]}")
53 | ]
54 | end
55 |
56 | # Rails config changes
57 | watch(rails.spec_helper) { rspec.spec_dir }
58 | watch(rails.routes) { "#{rspec.spec_dir}/routing" }
59 | watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
60 |
61 | # Capybara features specs
62 | watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
63 | watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
64 |
65 | # Turnip features and steps
66 | watch(%r{^spec/acceptance/(.+)\.feature$})
67 | watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
68 | Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
69 | end
70 | end
71 |
--------------------------------------------------------------------------------
/GmtcClient/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Disabling obfuscation is useful if you collect stack traces from production crashes
20 | # (unless you are using a system that supports de-obfuscate the stack traces).
21 | -dontobfuscate
22 |
23 | # React Native
24 |
25 | # Keep our interfaces so they can be used by other ProGuard rules.
26 | # See http://sourceforge.net/p/proguard/bugs/466/
27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
30 |
31 | # Do not strip any method/class that is annotated with @DoNotStrip
32 | -keep @com.facebook.proguard.annotations.DoNotStrip class *
33 | -keep @com.facebook.common.internal.DoNotStrip class *
34 | -keepclassmembers class * {
35 | @com.facebook.proguard.annotations.DoNotStrip *;
36 | @com.facebook.common.internal.DoNotStrip *;
37 | }
38 |
39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
40 | void set*(***);
41 | *** get*();
42 | }
43 |
44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; }
46 | -keepclassmembers,includedescriptorclasses class * { native ; }
47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; }
48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; }
49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; }
50 |
51 | -dontwarn com.facebook.react.**
52 |
53 | # okhttp
54 |
55 | -keepattributes Signature
56 | -keepattributes *Annotation*
57 | -keep class okhttp3.** { *; }
58 | -keep interface okhttp3.** { *; }
59 | -dontwarn okhttp3.**
60 |
61 | # okio
62 |
63 | -keep class sun.misc.Unsafe { *; }
64 | -dontwarn java.nio.file.*
65 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
66 | -dontwarn okio.**
67 |
--------------------------------------------------------------------------------
/GmtcClient/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/server/spec/rails_helper.rb:
--------------------------------------------------------------------------------
1 | # This file is copied to spec/ when you run 'rails generate rspec:install'
2 | ENV['RAILS_ENV'] ||= 'test'
3 | require File.expand_path('../../config/environment', __FILE__)
4 | # Prevent database truncation if the environment is production
5 | abort("The Rails environment is running in production mode!") if Rails.env.production?
6 | require 'spec_helper'
7 | require 'rspec/rails'
8 | # Add additional requires below this line. Rails is not loaded until this point!
9 |
10 | # Requires supporting ruby files with custom matchers and macros, etc, in
11 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
12 | # run as spec files by default. This means that files in spec/support that end
13 | # in _spec.rb will both be required and run as specs, causing the specs to be
14 | # run twice. It is recommended that you do not name files matching this glob to
15 | # end with _spec.rb. You can configure this pattern with the --pattern
16 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
17 | #
18 | # The following line is provided for convenience purposes. It has the downside
19 | # of increasing the boot-up time by auto-requiring all files in the support
20 | # directory. Alternatively, in the individual `*_spec.rb` files, manually
21 | # require only the support files necessary.
22 | #
23 | # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
24 |
25 | # Checks for pending migration and applies them before tests are run.
26 | # If you are not using ActiveRecord, you can remove this line.
27 | ActiveRecord::Migration.maintain_test_schema!
28 |
29 | RSpec.configure do |config|
30 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
31 | config.fixture_path = "#{::Rails.root}/spec/fixtures"
32 |
33 | # If you're not using ActiveRecord, or you'd prefer not to run each of your
34 | # examples within a transaction, remove the following line or assign false
35 | # instead of true.
36 | config.use_transactional_fixtures = true
37 |
38 | # RSpec Rails can automatically mix in different behaviours to your tests
39 | # based on their file location, for example enabling you to call `get` and
40 | # `post` in specs under `spec/controllers`.
41 | #
42 | # You can disable this behaviour by removing the line below, and instead
43 | # explicitly tag your specs with their type, e.g.:
44 | #
45 | # RSpec.describe UsersController, :type => :controller do
46 | # # ...
47 | # end
48 | #
49 | # The different available types are documented in the features, such as in
50 | # https://relishapp.com/rspec/rspec-rails/docs
51 | config.infer_spec_type_from_file_location!
52 |
53 | # Filter lines from Rails gems in backtraces.
54 | config.filter_rails_from_backtrace!
55 | # arbitrary gems may also be filtered via:
56 | # config.filter_gems_from_backtrace("gem name")
57 | end
58 |
--------------------------------------------------------------------------------
/GmtcClient/src/components/F8PageControl.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 Facebook, Inc.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to
5 | * use, copy, modify, and distribute this software in source code or binary
6 | * form for use in connection with the web services and APIs provided by
7 | * Facebook.
8 | *
9 | * As with any software that integrates with the Facebook platform, your use
10 | * of this software is subject to the Facebook Developer Principles and
11 | * Policies [http://developers.facebook.com/policy/]. This copyright notice
12 | * shall be included in all copies or substantial portions of the software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE
21 | *
22 | * @providesModule F8PageControl
23 | * @flow
24 | */
25 | 'use strict';
26 |
27 | var React = require('React');
28 | var StyleSheet = require('StyleSheet');
29 | var View = require('View');
30 |
31 | var PropTypes = React.PropTypes;
32 |
33 | var F8PageControl = React.createClass({
34 | propTypes: {
35 | style: View.propTypes.style,
36 | count: PropTypes.number.isRequired,
37 | selectedIndex: PropTypes.number.isRequired,
38 | },
39 |
40 | render: function() {
41 | var images = [];
42 | for (var i = 0; i < this.props.count; i++) {
43 | var isSelected = this.props.selectedIndex === i;
44 | images.push();
45 | }
46 | return (
47 |
48 |
49 | {images}
50 |
51 |
52 | );
53 | }
54 | });
55 |
56 | var Circle = React.createClass({
57 | render: function() {
58 | var extraStyle = this.props.isSelected ? styles.full : styles.empty;
59 | return ;
60 | }
61 | });
62 |
63 | var CIRCLE_SIZE = 4;
64 |
65 | var styles = StyleSheet.create({
66 | container: {
67 | alignItems: 'center',
68 | justifyContent: 'center',
69 | },
70 | innerContainer: {
71 | flexDirection: 'row',
72 | },
73 | circle: {
74 | margin: 2,
75 | width: CIRCLE_SIZE,
76 | height: CIRCLE_SIZE,
77 | borderRadius: CIRCLE_SIZE / 2,
78 | },
79 | full: {
80 | backgroundColor: '#fff',
81 | },
82 | empty: {
83 | backgroundColor: '#fff5',
84 | },
85 | });
86 |
87 | module.exports = F8PageControl;
88 | module.exports.__cards__ = (define) => {
89 | define('Simple 2', () => );
90 | define('Simple 5', () => );
91 | };
92 |
--------------------------------------------------------------------------------
/GmtcClient/.flowconfig:
--------------------------------------------------------------------------------
1 | [ignore]
2 |
3 | # We fork some components by platform.
4 | .*/*.web.js
5 | .*/*.android.js
6 |
7 | # Some modules have their own node_modules with overlap
8 | .*/node_modules/node-haste/.*
9 |
10 | # Ugh
11 | .*/node_modules/babel.*
12 | .*/node_modules/babylon.*
13 | .*/node_modules/invariant.*
14 |
15 | # Ignore react and fbjs where there are overlaps, but don't ignore
16 | # anything that react-native relies on
17 | .*/node_modules/fbjs/lib/Map.js
18 | .*/node_modules/fbjs/lib/ErrorUtils.js
19 |
20 | # Flow has a built-in definition for the 'react' module which we prefer to use
21 | # over the currently-untyped source
22 | .*/node_modules/react/react.js
23 | .*/node_modules/react/lib/React.js
24 | .*/node_modules/react/lib/ReactDOM.js
25 |
26 | .*/__mocks__/.*
27 | .*/__tests__/.*
28 |
29 | .*/commoner/test/source/widget/share.js
30 |
31 | # Ignore commoner tests
32 | .*/node_modules/commoner/test/.*
33 |
34 | # See https://github.com/facebook/flow/issues/442
35 | .*/react-tools/node_modules/commoner/lib/reader.js
36 |
37 | # Ignore jest
38 | .*/node_modules/jest-cli/.*
39 |
40 | # Ignore Website
41 | .*/website/.*
42 |
43 | # Ignore generators
44 | .*/local-cli/generator.*
45 |
46 | # Ignore BUCK generated folders
47 | .*\.buckd/
48 |
49 | # Ignore RNPM
50 | .*/local-cli/rnpm/.*
51 |
52 | .*/node_modules/is-my-json-valid/test/.*\.json
53 | .*/node_modules/iconv-lite/encodings/tables/.*\.json
54 | .*/node_modules/y18n/test/.*\.json
55 | .*/node_modules/spdx-license-ids/spdx-license-ids.json
56 | .*/node_modules/spdx-exceptions/index.json
57 | .*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json
58 | .*/node_modules/resolve/lib/core.json
59 | .*/node_modules/jsonparse/samplejson/.*\.json
60 | .*/node_modules/json5/test/.*\.json
61 | .*/node_modules/ua-parser-js/test/.*\.json
62 | .*/node_modules/builtin-modules/builtin-modules.json
63 | .*/node_modules/binary-extensions/binary-extensions.json
64 | .*/node_modules/url-regex/tlds.json
65 | .*/node_modules/joi/.*\.json
66 | .*/node_modules/isemail/.*\.json
67 | .*/node_modules/tr46/.*\.json
68 |
69 |
70 | [include]
71 |
72 | [libs]
73 | node_modules/react-native/Libraries/react-native/react-native-interface.js
74 | node_modules/react-native/flow
75 | flow/
76 |
77 | [options]
78 | module.system=haste
79 |
80 | esproposal.class_static_fields=enable
81 | esproposal.class_instance_fields=enable
82 |
83 | experimental.strict_type_args=true
84 |
85 | munge_underscores=true
86 |
87 | module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
88 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
89 |
90 | suppress_type=$FlowIssue
91 | suppress_type=$FlowFixMe
92 | suppress_type=$FixMe
93 |
94 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-6]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
95 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-6]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
96 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
97 |
98 | [version]
99 | ^0.26.0
100 |
--------------------------------------------------------------------------------
/GmtcClient/src/pages/MySchedules.js:
--------------------------------------------------------------------------------
1 | import React, { Component, PropTypes } from 'react'
2 | import PureListView from '../components/PureListView'
3 | import {connect} from 'react-redux'
4 | import TopicsCarousel from './TopicsCarousel'
5 | import Topic from './Topic'
6 | import {genSubscribedData} from '../helper/dataHelper'
7 | import SubscribeButton from '../components/SubscribeButton'
8 | import ListContainer from '../components/ListContainer'
9 | import {EMPTY_CELL_HEIGHT} from '../components/ListContainer'
10 | import {
11 | View,
12 | Text,
13 | StyleSheet,
14 | Image,
15 | TouchableOpacity
16 | } from 'react-native'
17 |
18 | class MySchedules extends Component {
19 | static propTypes = {
20 | navigator: PropTypes.object,
21 | days: PropTypes.array.isRequired,
22 | topics: PropTypes.object,
23 | emptyOperation: PropTypes.func
24 | };
25 |
26 | render () {
27 | let profilePicture = (
28 |
31 | )
32 | return (
33 |
38 |
43 |
44 | )
45 | }
46 |
47 | renderEmptyView = () => {
48 | return (
49 |
50 |
51 | 您订阅的主题将会{'\n'}展现于此
52 |
53 |
54 | )
55 | }
56 |
57 | renderRow = (item, index, renderSeparator) => {
58 | return (
59 | this.goToCarousel(item)}>
60 |
61 |
62 | )
63 | }
64 |
65 | goToCarousel = (item) => {
66 | this.props.navigator.push({
67 | component: TopicsCarousel,
68 | day: this.props.days[item.room.day_id - 1],
69 | topic: item
70 | })
71 | }
72 |
73 | renderSectionHeader = (sectionData, time) => {
74 | const dayName = ['第一天', '第二天']
75 | if (sectionData.length === 0) {
76 | return null
77 | }
78 | return (
79 |
80 | {dayName[time - 1]}
81 |
82 | )
83 | }
84 | }
85 |
86 | const styles = StyleSheet.create({
87 | font: {
88 | fontSize: 12.5,
89 | color: '#555555'
90 | },
91 | message: {
92 | textAlign: 'center',
93 | fontSize: 14,
94 | lineHeight: 22,
95 | color: '#7a8698'
96 | }
97 | })
98 |
99 | const mapStateToProps = state => ({
100 | days: state.data.days,
101 | topics: genSubscribedData(state.data.days, state.schedule.subscription)
102 | })
103 |
104 | module.exports = connect(mapStateToProps)(MySchedules)
105 |
--------------------------------------------------------------------------------
/server/db/schema.rb:
--------------------------------------------------------------------------------
1 | # encoding: UTF-8
2 | # This file is auto-generated from the current state of the database. Instead
3 | # of editing this file, please use the migrations feature of Active Record to
4 | # incrementally modify your database, and then regenerate this schema definition.
5 | #
6 | # Note that this schema.rb definition is the authoritative source for your
7 | # database schema. If you need to create the application database on another
8 | # system, you should be using db:schema:load, not running all the migrations
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 | # you'll amass, the slower it'll run and the greater likelihood for issues).
11 | #
12 | # It's strongly recommended that you check this file into your version control system.
13 |
14 | ActiveRecord::Schema.define(version: 20160623072040) do
15 |
16 | create_table "active_admin_comments", force: :cascade do |t|
17 | t.string "namespace"
18 | t.text "body"
19 | t.string "resource_id", null: false
20 | t.string "resource_type", null: false
21 | t.integer "author_id"
22 | t.string "author_type"
23 | t.datetime "created_at"
24 | t.datetime "updated_at"
25 | end
26 |
27 | add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id"
28 | add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace"
29 | add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id"
30 |
31 | create_table "admin_users", force: :cascade do |t|
32 | t.string "email", default: "", null: false
33 | t.string "encrypted_password", default: "", null: false
34 | t.string "reset_password_token"
35 | t.datetime "reset_password_sent_at"
36 | t.datetime "remember_created_at"
37 | t.integer "sign_in_count", default: 0, null: false
38 | t.datetime "current_sign_in_at"
39 | t.datetime "last_sign_in_at"
40 | t.string "current_sign_in_ip"
41 | t.string "last_sign_in_ip"
42 | t.datetime "created_at", null: false
43 | t.datetime "updated_at", null: false
44 | end
45 |
46 | add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true
47 | add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
48 |
49 | create_table "days", force: :cascade do |t|
50 | t.string "name"
51 | t.date "date"
52 | t.datetime "created_at", null: false
53 | t.datetime "updated_at", null: false
54 | end
55 |
56 | create_table "rooms", force: :cascade do |t|
57 | t.integer "day_id"
58 | t.string "name"
59 | t.string "description"
60 | t.string "location"
61 | t.datetime "created_at", null: false
62 | t.datetime "updated_at", null: false
63 | end
64 |
65 | add_index "rooms", ["day_id"], name: "index_rooms_on_day_id"
66 |
67 | create_table "topics", force: :cascade do |t|
68 | t.integer "room_id"
69 | t.string "author"
70 | t.string "author_info"
71 | t.string "author_avatars"
72 | t.string "title"
73 | t.text "description"
74 | t.boolean "rest"
75 | t.time "start_at"
76 | t.time "end_at"
77 | t.datetime "created_at", null: false
78 | t.datetime "updated_at", null: false
79 | end
80 |
81 | add_index "topics", ["room_id"], name: "index_topics_on_room_id"
82 |
83 | end
84 |
--------------------------------------------------------------------------------
/server/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # Code is not reloaded between requests.
5 | config.cache_classes = true
6 |
7 | # Eager load code on boot. This eager loads most of Rails and
8 | # your application in memory, allowing both threaded web servers
9 | # and those relying on copy on write to perform better.
10 | # Rake tasks automatically ignore this option for performance.
11 | config.eager_load = true
12 |
13 | # Full error reports are disabled and caching is turned on.
14 | config.consider_all_requests_local = false
15 | config.action_controller.perform_caching = true
16 |
17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application
18 | # Add `rack-cache` to your Gemfile before enabling this.
19 | # For large-scale production use, consider using a caching reverse proxy like
20 | # NGINX, varnish or squid.
21 | # config.action_dispatch.rack_cache = true
22 |
23 | # Disable serving static files from the `/public` folder by default since
24 | # Apache or NGINX already handles this.
25 | config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
26 |
27 | # Compress JavaScripts and CSS.
28 | config.assets.js_compressor = :uglifier
29 | # config.assets.css_compressor = :sass
30 |
31 | # Do not fallback to assets pipeline if a precompiled asset is missed.
32 | config.assets.compile = false
33 |
34 | # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35 | # yet still be able to expire them through the digest params.
36 | config.assets.digest = true
37 |
38 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
39 |
40 | # Specifies the header that your server uses for sending files.
41 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
43 |
44 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45 | # config.force_ssl = true
46 |
47 | # Use the lowest log level to ensure availability of diagnostic information
48 | # when problems arise.
49 | config.log_level = :debug
50 |
51 | # Prepend all log lines with the following tags.
52 | # config.log_tags = [ :subdomain, :uuid ]
53 |
54 | # Use a different logger for distributed setups.
55 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
56 |
57 | # Use a different cache store in production.
58 | # config.cache_store = :mem_cache_store
59 |
60 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61 | # config.action_controller.asset_host = 'http://assets.example.com'
62 |
63 | # Ignore bad email addresses and do not raise email delivery errors.
64 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65 | # config.action_mailer.raise_delivery_errors = false
66 |
67 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68 | # the I18n.default_locale when a translation cannot be found).
69 | config.i18n.fallbacks = true
70 |
71 | # Send deprecation notices to registered listeners.
72 | config.active_support.deprecation = :notify
73 |
74 | # Use default logging formatter so that PID and timestamp are not suppressed.
75 | config.log_formatter = ::Logger::Formatter.new
76 |
77 | # Do not dump schema after migrations.
78 | config.active_record.dump_schema_after_migration = false
79 | end
80 |
--------------------------------------------------------------------------------
/server/lib/tasks/gmtc.rake:
--------------------------------------------------------------------------------
1 | require 'open-uri'
2 | require 'hpricot'
3 |
4 | namespace :gmtc do
5 | task :get_data => :environment do
6 | url_prefix = 'http://gmtc.geekbang.org/'
7 | link = 'http://gmtc.geekbang.org/'
8 | doc = Hpricot(open(link))
9 |
10 | banner = url_prefix + doc.search('.header1 img').first.attributes['src']
11 | introdution = doc.search('.introdution').first.innerText
12 | puts banner, introdution
13 |
14 | author_avatars = {}
15 |
16 | puts '=============== CO-CHAIRS ================'
17 | co_chairs, speackers = doc.search('.xig')
18 | co_chairs = co_chairs.search('.hud')
19 | co_chairs.each do |chair|
20 | avatar = url_prefix + chair.search('.on_list img').first.attributes['src']
21 | name = chair.search('.onea b').first.innerText.strip
22 | company = chair.search('span')[1].innerText.gsub(/ +/, '')
23 | dids = chair.search('.dids').first.innerText
24 | puts avatar, name, company, dids, '===================='
25 | author_avatars[name]= avatar
26 | end
27 |
28 | puts '=============== SPEAKERS ================='
29 | speackers = speackers.search('.hud')
30 | speackers.each do |speacker|
31 | avatar = url_prefix + speacker.search('.on_list img').first.attributes['src']
32 | name = speacker.search('.onea b').first.innerText.strip
33 | company = speacker.search('span')[1].innerText.gsub(/ +/, '')
34 | dids = speacker.search('.dids').first.innerText
35 | puts avatar, name, company, dids, '===================='
36 | author_avatars[name]= avatar
37 | end
38 |
39 | puts '=============== SCHEDULE ================='
40 | days = doc.search('.big_list li')
41 | room = nil
42 | days.each_with_index do |day_dom, index|
43 | dates = ['2016-06-24', '2016-06-25']
44 | day_name = ['第一天', '第二天'][index]
45 | day_date = dates[index]
46 | day = Day.find_or_create_by!(name: day_name, date: day_date)
47 | puts "============ Add #{day_name} ========="
48 |
49 | lines = day_dom.search('table tr')[1..-1]
50 | lines.each do |line|
51 | if line.attributes['class'] == 'onetr'
52 | room_name, room_desc = line.search('.td12').first.innerText.lines.map(&:strip)
53 | puts "======= Add room: #{room_name} ========"
54 | room = day.rooms.find_or_create_by!(name: room_name, description: room_desc)
55 | else
56 | time_range, title, author =
57 | line.search('.td12').map(&:innerText).map do |item|
58 | item.gsub(/ +/, '')
59 | end
60 |
61 | next unless time_range
62 |
63 | title, *desc = title.lines.map(&:strip)
64 | desc = desc.join('\n')
65 | puts "======= Add topic: #{title} ========"
66 |
67 | author_info = nil
68 | if author
69 | author, *author_info = author.lines.map(&:strip)
70 | author_info = author_info.join('\n') if author_info
71 | end
72 |
73 | rest = title == '茶歇' || title == '短休'
74 | start_at, end_at = time_range.split('~')
75 | authors = author ? author.gsub(/\([^\)]+\)/, '').gsub(/([^)]+)/, '').split('、') : []
76 | avatars = authors.map{|a| author_avatars[a]}.select{|e| !e.nil?}
77 |
78 | room.topics.create!(
79 | author: author,
80 | author_info: author_info,
81 | author_avatars: avatars,
82 | title: title,
83 | rest: rest,
84 | description: desc,
85 | start_at: start_at,
86 | end_at: end_at
87 | )
88 | end
89 | end
90 | end
91 | end
92 | end
93 |
--------------------------------------------------------------------------------
/GmtcClient/ios/GmtcClient/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/GmtcClient/src/pages/TopicDetail.js:
--------------------------------------------------------------------------------
1 | import React, {Component, PropTypes} from 'react'
2 | import Topic from './Topic'
3 | import {connect} from 'react-redux'
4 | import {subscribe, unsubscribe} from '../reducers/schedule'
5 | import SubscribeButton from '../components/SubscribeButton'
6 | import {
7 | View,
8 | Text,
9 | Image,
10 | ScrollView,
11 | StyleSheet
12 | } from 'react-native'
13 | const AWESOME_COLOR = ['red', 'orange', 'green', 'cyan', 'blue', 'purple']
14 | export default class TopicDetail extends Component {
15 | static propTypes = {
16 | topic: PropTypes.object,
17 | subscribe: PropTypes.func,
18 | unsubscribe: PropTypes.func,
19 | isSubscribed: PropTypes.bool,
20 | style: View.propTypes.style
21 | }
22 |
23 | render () {
24 | const {topic, isSubscribed} = this.props
25 | const address = topic.room.name
26 | const duration = getDuration(topic.start_at, topic.end_at)
27 | const addressColor = AWESOME_COLOR[topic.id % AWESOME_COLOR.length]
28 | return (
29 |
30 |
31 | {address}
32 | - {duration} min
33 |
34 |
35 |
36 | {convert(topic.description)}
37 | {this.renderRest()}
38 |
39 | { !topic.rest &&
40 |
41 |
42 |
43 | }
44 |
45 | )
46 | }
47 |
48 | toggleAdded = () => {
49 | if (this.props.isSubscribed) {
50 | this.props.unsubscribe()
51 | } else {
52 | this.props.subscribe()
53 | }
54 | };
55 |
56 | renderRest = () => {
57 | if (this.props.topic.rest) {
58 | return (
59 |
60 |
61 |
62 |
63 | )
64 | }
65 | }
66 | }
67 |
68 | function convert (input) {
69 | return input.replace(/\\n/g, '\n')
70 | }
71 |
72 | function getDuration (start, end) {
73 | const startHour = start.slice(11, 13)
74 | const startMin = start.slice(14, 16)
75 | const endHour = end.slice(11, 13)
76 | const endMin = end.slice(14, 16)
77 | return (endHour - startHour) * 60 + (endMin - startMin)
78 | }
79 |
80 | const styles = StyleSheet.create({
81 | container: {
82 | flex: 1,
83 | backgroundColor: 'white',
84 | padding: 10
85 | },
86 | header: {
87 | flexDirection: 'row',
88 | alignItems: 'center',
89 | height: 30,
90 | borderBottomWidth: 1,
91 | borderColor: '#eee'
92 | },
93 | headerFont: {
94 | fontSize: 11,
95 | color: '#555555'
96 | },
97 | content: {
98 | padding: 10
99 | },
100 | description: {
101 | fontSize: 13,
102 | marginTop: 10,
103 | lineHeight: 20,
104 | color: '#555555'
105 | },
106 | footer: {
107 | borderTopWidth: 1,
108 | borderColor: '#eee'
109 | }
110 | })
111 |
112 | const mapStateToProps = (state, props) => ({
113 | loading: state.schedule.loading,
114 | error: state.schedule.error,
115 | isSubscribed: state.schedule.subscription.includes(props.topic.id)
116 | })
117 |
118 | const mapDispatchToProps = (dispatch, props) => {
119 | return {
120 | subscribe: () => dispatch(subscribe(props.topic.id)),
121 | unsubscribe: () => dispatch(unsubscribe(props.topic.id))
122 | }
123 | }
124 |
125 | module.exports = connect(mapStateToProps, mapDispatchToProps)(TopicDetail)
126 |
--------------------------------------------------------------------------------
/GmtcClient/src/pages/TopicsCarousel.js:
--------------------------------------------------------------------------------
1 | import React, {Component, PropTypes} from 'react'
2 | import TopicDetail from './TopicDetail'
3 | import Carousel from '../components/Carousel'
4 | import F8PageControl from '../components/F8PageControl'
5 | import {
6 | View,
7 | Text,
8 | Image,
9 | TouchableOpacity,
10 | StyleSheet
11 | } from 'react-native'
12 |
13 | export default class extends Component {
14 |
15 | static propTypes = {
16 | day: PropTypes.object,
17 | topic: PropTypes.object,
18 | navigator: PropTypes.object
19 | };
20 |
21 | constructor (props) {
22 | super(props)
23 | let flatTopicsList = []
24 | let contexts = []
25 | const allTopics = this.props.day.topics
26 | for (let sectionID in allTopics) {
27 | const sectionLength = allTopics[sectionID].length
28 | const startTime = allTopics[sectionID][0].start_at.slice(11, 16)
29 | const endTime = allTopics[sectionID][0].end_at.slice(11, 16)
30 |
31 | let rowIndex = 0
32 | allTopics[sectionID].forEach(topic => {
33 | flatTopicsList.push(topic)
34 | contexts.push({
35 | rowIndex,
36 | sectionLength,
37 | sectionTitle: `${startTime}~${endTime}`
38 | })
39 | rowIndex++
40 | })
41 | }
42 |
43 | const selectedIndex = flatTopicsList.findIndex(s => s.id === this.props.topic.id)
44 |
45 | this.state = {
46 | count: flatTopicsList.length,
47 | selectedIndex,
48 | flatTopicsList,
49 | contexts
50 | }
51 | this.dismiss = this.dismiss.bind(this)
52 | this.renderCard = this.renderCard.bind(this)
53 | this.handleIndexChange = this.handleIndexChange.bind(this)
54 | }
55 |
56 | render () {
57 | const {rowIndex, sectionLength, sectionTitle} = this.state.contexts[this.state.selectedIndex]
58 | return (
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | {this.props.day.name}
67 | {'\n'}
68 | {sectionTitle}
69 |
70 |
74 |
75 |
76 |
77 |
83 |
84 | )
85 | }
86 |
87 | renderCard (index) {
88 | return (
89 |
94 | )
95 | }
96 |
97 | handleIndexChange (selectedIndex) {
98 | this.setState({ selectedIndex })
99 | }
100 |
101 | dismiss () {
102 | this.props.navigator.pop()
103 | }
104 | }
105 |
106 | const styles = StyleSheet.create({
107 | container: {
108 | flex: 1,
109 | backgroundColor: '#6ec0df'
110 | },
111 | header: {
112 | paddingTop: 20,
113 | flexDirection: 'row'
114 | },
115 | headerLeft: {
116 | flex: 1,
117 | justifyContent: 'center',
118 | paddingLeft: 10
119 | },
120 | headerContent: {
121 | flex: 3,
122 | height: 44,
123 | alignItems: 'center',
124 | justifyContent: 'center'
125 | },
126 | title: {
127 | color: 'white',
128 | fontSize: 12,
129 | textAlign: 'center'
130 | },
131 | day: {
132 | fontWeight: 'bold'
133 | },
134 | card: {
135 | borderRadius: 2,
136 | marginHorizontal: 3
137 | }
138 | })
139 |
--------------------------------------------------------------------------------
/GmtcClient/src/pages/Schedules.js:
--------------------------------------------------------------------------------
1 | import React, { Component, PropTypes } from 'react'
2 | import PureListView from '../components/PureListView'
3 | import {connect} from 'react-redux'
4 | import {bindActionCreators} from 'redux'
5 | import {combineData} from '../helper/dataHelper'
6 | import {loadData} from '../reducers/data'
7 | import ListContainer from '../components/ListContainer'
8 | import TopicsCarousel from './TopicsCarousel'
9 | import Topic from './Topic'
10 | import {
11 | View,
12 | Text,
13 | StyleSheet,
14 | Image,
15 | TouchableOpacity
16 | } from 'react-native'
17 | const API = 'http://do.poberwong.com:8000/gmtc.json'
18 | class Schedules extends Component {
19 | static propTypes = {
20 | navigator: PropTypes.object,
21 | loadData: PropTypes.func,
22 | loading: PropTypes.bool.isRequired,
23 | days: PropTypes.array.isRequired
24 | };
25 |
26 | render () {
27 | if (this.props.loading || this.props.days.length === 0) {
28 | return (
29 |
30 | Loading...
31 |
32 | )
33 | }
34 | let parallaxContent = (
35 |
36 |
37 | 全球移动技术大会
38 | 2016年6月24日-25日
39 |
40 | )
41 | return (
42 |
47 |
53 |
59 |
60 | )
61 | }
62 |
63 | renderRow = (item, index) => {
64 | if (item.rest) {
65 | return
66 | }
67 | return (
68 | this.goToCarousel(item)}>
69 |
70 |
71 | )
72 | }
73 |
74 | goToCarousel = (item) => {
75 | // const dayId = item.room.day_id
76 | this.props.navigator.push({
77 | component: TopicsCarousel,
78 | day: this.props.days[item.room.day_id - 1],
79 | topic: item
80 | })
81 | }
82 |
83 | renderSectionHeader = (sectionData, time) => {
84 | const startTime = sectionData[0].start_at.slice(11, 16)
85 | const endTime = sectionData[0].end_at.slice(11, 16)
86 | return (
87 |
88 | {startTime}~{endTime}
89 |
90 | )
91 | }
92 |
93 | componentDidMount () {
94 | this.props.loadData(API)
95 | }
96 | }
97 |
98 | const styles = StyleSheet.create({
99 | container: {
100 | flex: 1
101 | },
102 | center: {
103 | alignItems: 'center',
104 | justifyContent: 'center'
105 | },
106 | font: {
107 | fontSize: 12.5,
108 | color: '#555555'
109 | }
110 | })
111 |
112 | const mapStateToProps = state => ({
113 | loading: state.data.loading,
114 | error: state.data.error,
115 | days: combineData(state.data.days, state.schedule.subscription)
116 | })
117 |
118 | const mapDispatchToProps = dispatch =>
119 | bindActionCreators({loadData}, dispatch)
120 |
121 | module.exports = connect(mapStateToProps, mapDispatchToProps)(Schedules)
122 |
--------------------------------------------------------------------------------
/GmtcClient/src/components/SegmentTab.js:
--------------------------------------------------------------------------------
1 | import React, { Component, PropTypes } from 'react'
2 | import {
3 | View,
4 | TouchableOpacity,
5 | StyleSheet,
6 | Text
7 | } from 'react-native'
8 |
9 | export default class extends Component {
10 | static propTypes = {
11 | data: PropTypes.array,
12 | titleSize: PropTypes.number,
13 | verticalWidth: PropTypes.number,
14 | onPress: PropTypes.func,
15 | verticalHeight: PropTypes.number,
16 | horizontalWidth: PropTypes.number,
17 | horizontalHeight: PropTypes.number,
18 | orientation: PropTypes.string,
19 | activeColor: PropTypes.string,
20 | inActiveColor: PropTypes.string,
21 | textActiveColor: PropTypes.string,
22 | textInActiveColor: PropTypes.string,
23 | selected: PropTypes.number,
24 | borderRadius: PropTypes.number,
25 | style: View.propTypes.style
26 | };
27 |
28 | static defaultProps = { // 返回默认的一些属性值
29 | data: ['One', 'Two', 'Three'],
30 | verticalWidth: 100,
31 | verticalHeight: 120,
32 | horizontalWidth: 200,
33 | horizontalHeight: 40,
34 | titleSize: 14,
35 | onPress () {},
36 | orientation: 'horizontal',
37 | activeColor: 'red',
38 | inActiveColor: 'transparent',
39 | textInActiveColor: 'white',
40 | selected: 0,
41 | textActiveColor: 'white',
42 | borderRadius: 5
43 | };
44 |
45 | renderTabOption (tab, index) {
46 | const {orientation, onPress, activeColor, inActiveColor, titleSize, textActiveColor, textInActiveColor, selected, borderRadius} = this.props
47 | const styles = createStyle(borderRadius)
48 | const isTabActive = selected === index
49 | const textColor = isTabActive ? textActiveColor : textInActiveColor
50 | const itemStyle = orientation === 'horizontal'
51 | ? (index === 0
52 | ? [styles.horizontalStartItem, {borderWidth: 1}]
53 | : (index < this.props.data.length - 1
54 | ? [{borderWidth: 1, borderLeftWidth: 0}]
55 | : [styles.horizontalEndItem, {borderWidth: 1, borderLeftWidth: 0, marginLeft: -1}]
56 | )
57 | )
58 | : (index === 0
59 | ? [styles.verticalStartItem, {borderWidth: 1}]
60 | : (index < this.props.data.length - 1
61 | ? [{borderWidth: 1, borderTopWidth: 0}]
62 | : [styles.verticalEndItem, {borderWidth: 1, borderTopWidth: 0, marginTop: -1}]
63 | )
64 | )
65 |
66 | return (
67 | onPress(index)}
69 | activeOpacity={1}
70 | style={[styles.item, {backgroundColor: (isTabActive ? activeColor : inActiveColor), borderColor: activeColor}, ...itemStyle]}>
71 | {tab}
72 | )
73 | }
74 |
75 | render () {
76 | const {verticalHeight, verticalWidth, horizontalHeight, horizontalWidth, data, orientation} = this.props
77 |
78 | const style = orientation === 'horizontal'
79 | ? [{height: horizontalHeight, width: horizontalWidth, flexDirection: 'row'}]
80 | : [{width: verticalWidth, height: verticalHeight, flexDirection: 'column'}]
81 | return (
82 |
83 | {data.map((item, index) => this.renderTabOption(item, index))}
84 |
85 | )
86 | }
87 | }
88 |
89 | function createStyle (borderRadius) {
90 | return StyleSheet.create({
91 | item: {
92 | flex: 1,
93 | justifyContent: 'center',
94 | alignItems: 'center'
95 | },
96 | horizontalStartItem: {
97 | borderTopLeftRadius: borderRadius,
98 | borderBottomLeftRadius: borderRadius
99 | },
100 | horizontalEndItem: {
101 | borderTopRightRadius: borderRadius,
102 | borderBottomRightRadius: borderRadius
103 | },
104 | verticalStartItem: {
105 | borderTopLeftRadius: borderRadius,
106 | borderTopRightRadius: borderRadius
107 | },
108 | verticalEndItem: {
109 | borderBottomLeftRadius: borderRadius,
110 | borderBottomRightRadius: borderRadius
111 | }
112 | })
113 | }
114 |
--------------------------------------------------------------------------------
/server/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2 |
3 | en:
4 | devise:
5 | confirmations:
6 | confirmed: "Your email address has been successfully confirmed."
7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9 | failure:
10 | already_authenticated: "You are already signed in."
11 | inactive: "Your account is not activated yet."
12 | invalid: "Invalid %{authentication_keys} or password."
13 | locked: "Your account is locked."
14 | last_attempt: "You have one more attempt before your account is locked."
15 | not_found_in_database: "Invalid %{authentication_keys} or password."
16 | timeout: "Your session expired. Please sign in again to continue."
17 | unauthenticated: "You need to sign in or sign up before continuing."
18 | unconfirmed: "You have to confirm your email address before continuing."
19 | mailer:
20 | confirmation_instructions:
21 | subject: "Confirmation instructions"
22 | reset_password_instructions:
23 | subject: "Reset password instructions"
24 | unlock_instructions:
25 | subject: "Unlock instructions"
26 | password_change:
27 | subject: "Password Changed"
28 | omniauth_callbacks:
29 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
30 | success: "Successfully authenticated from %{kind} account."
31 | passwords:
32 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
33 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
34 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
35 | updated: "Your password has been changed successfully. You are now signed in."
36 | updated_not_active: "Your password has been changed successfully."
37 | registrations:
38 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
39 | signed_up: "Welcome! You have signed up successfully."
40 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
41 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
42 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
43 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
44 | updated: "Your account has been updated successfully."
45 | sessions:
46 | signed_in: "Signed in successfully."
47 | signed_out: "Signed out successfully."
48 | already_signed_out: "Signed out successfully."
49 | unlocks:
50 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
51 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
52 | unlocked: "Your account has been unlocked successfully. Please sign in to continue."
53 | errors:
54 | messages:
55 | already_confirmed: "was already confirmed, please try signing in"
56 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
57 | expired: "has expired, please request a new one"
58 | not_found: "not found"
59 | not_locked: "was not locked"
60 | not_saved:
61 | one: "1 error prohibited this %{resource} from being saved:"
62 | other: "%{count} errors prohibited this %{resource} from being saved:"
63 |
--------------------------------------------------------------------------------
/server/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3 | # The generated `.rspec` file contains `--require spec_helper` which will cause
4 | # this file to always be loaded, without a need to explicitly require it in any
5 | # files.
6 | #
7 | # Given that it is always loaded, you are encouraged to keep this file as
8 | # light-weight as possible. Requiring heavyweight dependencies from this file
9 | # will add to the boot time of your test suite on EVERY test run, even for an
10 | # individual file that may not need all of that loaded. Instead, consider making
11 | # a separate helper file that requires the additional dependencies and performs
12 | # the additional setup, and require it from the spec files that actually need
13 | # it.
14 | #
15 | # The `.rspec` file also contains a few flags that are not defaults but that
16 | # users commonly want.
17 | #
18 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19 | RSpec.configure do |config|
20 | # rspec-expectations config goes here. You can use an alternate
21 | # assertion/expectation library such as wrong or the stdlib/minitest
22 | # assertions if you prefer.
23 | config.expect_with :rspec do |expectations|
24 | # This option will default to `true` in RSpec 4. It makes the `description`
25 | # and `failure_message` of custom matchers include text for helper methods
26 | # defined using `chain`, e.g.:
27 | # be_bigger_than(2).and_smaller_than(4).description
28 | # # => "be bigger than 2 and smaller than 4"
29 | # ...rather than:
30 | # # => "be bigger than 2"
31 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32 | end
33 |
34 | # rspec-mocks config goes here. You can use an alternate test double
35 | # library (such as bogus or mocha) by changing the `mock_with` option here.
36 | config.mock_with :rspec do |mocks|
37 | # Prevents you from mocking or stubbing a method that does not exist on
38 | # a real object. This is generally recommended, and will default to
39 | # `true` in RSpec 4.
40 | mocks.verify_partial_doubles = true
41 | end
42 |
43 | config.filter_run :focus
44 | config.run_all_when_everything_filtered = true
45 |
46 | # The settings below are suggested to provide a good initial experience
47 | # with RSpec, but feel free to customize to your heart's content.
48 | =begin
49 | # These two settings work together to allow you to limit a spec run
50 | # to individual examples or groups you care about by tagging them with
51 | # `:focus` metadata. When nothing is tagged with `:focus`, all examples
52 | # get run.
53 | config.filter_run :focus
54 | config.run_all_when_everything_filtered = true
55 |
56 | # Allows RSpec to persist some state between runs in order to support
57 | # the `--only-failures` and `--next-failure` CLI options. We recommend
58 | # you configure your source control system to ignore this file.
59 | config.example_status_persistence_file_path = "spec/examples.txt"
60 |
61 | # Limits the available syntax to the non-monkey patched syntax that is
62 | # recommended. For more details, see:
63 | # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
64 | # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
65 | # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
66 | config.disable_monkey_patching!
67 |
68 | # Many RSpec users commonly either run the entire suite or an individual
69 | # file, and it's useful to allow more verbose output when running an
70 | # individual spec file.
71 | if config.files_to_run.one?
72 | # Use the documentation formatter for detailed output,
73 | # unless a formatter has already been configured
74 | # (e.g. via a command-line flag).
75 | config.default_formatter = 'doc'
76 | end
77 |
78 | # Print the 10 slowest examples and example groups at the
79 | # end of the spec run, to help surface which specs are running
80 | # particularly slow.
81 | config.profile_examples = 10
82 |
83 | # Run specs in random order to surface order dependencies. If you find an
84 | # order dependency and want to debug it, you can fix the order by providing
85 | # the seed, which is printed after each run.
86 | # --seed 1234
87 | config.order = :random
88 |
89 | # Seed global randomization in this process using the `--seed` CLI option.
90 | # Setting this allows you to use `--seed` to deterministically reproduce
91 | # test failures related to randomization by passing the same `--seed` value
92 | # as the one that triggered the failure.
93 | Kernel.srand config.seed
94 | =end
95 | end
96 |
--------------------------------------------------------------------------------
/GmtcClient/ios/GmtcClient.xcodeproj/xcshareddata/xcschemes/GmtcClient.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
77 |
83 |
84 |
85 |
86 |
87 |
88 |
94 |
96 |
102 |
103 |
104 |
105 |
107 |
108 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/GmtcClient/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/GmtcClient/src/components/ViewPager.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 Facebook, Inc.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to
5 | * use, copy, modify, and distribute this software in source code or binary
6 | * form for use in connection with the web services and APIs provided by
7 | * Facebook.
8 | *
9 | * As with any software that integrates with the Facebook platform, your use
10 | * of this software is subject to the Facebook Developer Principles and
11 | * Policies [http://developers.facebook.com/policy/]. This copyright notice
12 | * shall be included in all copies or substantial portions of the software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE
21 | *
22 | * @flow
23 | */
24 | 'use strict';
25 |
26 | const React = require('react');
27 |
28 | const {
29 | View,
30 | StyleSheet,
31 | ScrollView,
32 | ViewPagerAndroid,
33 | Platform,
34 | } = require('react-native');
35 |
36 | type Props = {
37 | count: number;
38 | selectedIndex: number;
39 | onSelectedIndexChange?: (index: number) => void;
40 | bounces?: boolean;
41 | children?: any;
42 | style?: any;
43 | };
44 |
45 | type State = {
46 | width: number;
47 | height: number;
48 | selectedIndex: number;
49 | initialSelectedIndex: number;
50 | scrollingTo: ?number;
51 | };
52 |
53 | class ViewPager extends React.Component {
54 | props: Props;
55 | state: State;
56 |
57 | constructor(props: Props) {
58 | super(props);
59 | this.state = {
60 | width: 0,
61 | height: 0,
62 | selectedIndex: this.props.selectedIndex,
63 | initialSelectedIndex: this.props.selectedIndex,
64 | scrollingTo: null,
65 | };
66 | (this: any).handleHorizontalScroll = this.handleHorizontalScroll.bind(this);
67 | (this: any).adjustCardSize = this.adjustCardSize.bind(this);
68 | }
69 |
70 | render() {
71 | if (Platform.OS === 'ios') {
72 | return this.renderIOS();
73 | } else {
74 | return this.renderAndroid();
75 | }
76 | }
77 |
78 | renderIOS() {
79 | return (
80 |
99 | {this.renderContent()}
100 |
101 | );
102 | }
103 |
104 | renderAndroid() {
105 | return (
106 |
111 | {this.renderContent()}
112 |
113 | );
114 | }
115 |
116 | adjustCardSize(e: any) {
117 | this.setState({
118 | width: e.nativeEvent.layout.width,
119 | height: e.nativeEvent.layout.height,
120 | });
121 | }
122 |
123 | componentWillReceiveProps(nextProps: Props) {
124 | if (nextProps.selectedIndex !== this.state.selectedIndex) {
125 | if (Platform.OS === 'ios') {
126 | this.refs.scrollview.scrollTo({
127 | x: nextProps.selectedIndex * this.state.width,
128 | animated: true,
129 | });
130 | this.setState({scrollingTo: nextProps.selectedIndex});
131 | } else {
132 | this.refs.scrollview.setPage(nextProps.selectedIndex);
133 | this.setState({selectedIndex: nextProps.selectedIndex});
134 | }
135 | }
136 | }
137 |
138 | renderContent(): Array {
139 | var {width, height} = this.state;
140 | var style = Platform.OS === 'ios' && styles.card;
141 | return React.Children.map(this.props.children, (child, i) => (
142 |
143 | {child}
144 |
145 | ));
146 | }
147 |
148 | handleHorizontalScroll(e: any) {
149 | var selectedIndex = e.nativeEvent.position;
150 | if (selectedIndex === undefined) {
151 | selectedIndex = Math.round(
152 | e.nativeEvent.contentOffset.x / this.state.width,
153 | );
154 | }
155 | if (selectedIndex < 0 || selectedIndex >= this.props.count) {
156 | return;
157 | }
158 | if (this.state.scrollingTo !== null && this.state.scrollingTo !== selectedIndex) {
159 | return;
160 | }
161 | if (this.props.selectedIndex !== selectedIndex || this.state.scrollingTo !== null) {
162 | this.setState({selectedIndex, scrollingTo: null});
163 | const {onSelectedIndexChange} = this.props;
164 | onSelectedIndexChange && onSelectedIndexChange(selectedIndex);
165 | }
166 | }
167 | }
168 |
169 | var styles = StyleSheet.create({
170 | container: {
171 | flex: 1,
172 | },
173 | scrollview: {
174 | flex: 1,
175 | backgroundColor: 'transparent',
176 | },
177 | card: {
178 | backgroundColor: 'transparent',
179 | }
180 | });
181 |
182 | module.exports = ViewPager;
183 |
--------------------------------------------------------------------------------
/GmtcClient/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | import com.android.build.OutputFile
4 |
5 | /**
6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7 | * and bundleReleaseJsAndAssets).
8 | * These basically call `react-native bundle` with the correct arguments during the Android build
9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10 | * bundle directly from the development server. Below you can see all the possible configurations
11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the
12 | * `apply from: "../../node_modules/react-native/react.gradle"` line.
13 | *
14 | * project.ext.react = [
15 | * // the name of the generated asset file containing your JS bundle
16 | * bundleAssetName: "index.android.bundle",
17 | *
18 | * // the entry file for bundle generation
19 | * entryFile: "index.android.js",
20 | *
21 | * // whether to bundle JS and assets in debug mode
22 | * bundleInDebug: false,
23 | *
24 | * // whether to bundle JS and assets in release mode
25 | * bundleInRelease: true,
26 | *
27 | * // whether to bundle JS and assets in another build variant (if configured).
28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29 | * // The configuration property can be in the following formats
30 | * // 'bundleIn${productFlavor}${buildType}'
31 | * // 'bundleIn${buildType}'
32 | * // bundleInFreeDebug: true,
33 | * // bundleInPaidRelease: true,
34 | * // bundleInBeta: true,
35 | *
36 | * // the root of your project, i.e. where "package.json" lives
37 | * root: "../../",
38 | *
39 | * // where to put the JS bundle asset in debug mode
40 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
41 | *
42 | * // where to put the JS bundle asset in release mode
43 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
44 | *
45 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
46 | * // require('./image.png')), in debug mode
47 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
48 | *
49 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
50 | * // require('./image.png')), in release mode
51 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
52 | *
53 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
54 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
55 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle
56 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
57 | * // for example, you might want to remove it from here.
58 | * inputExcludes: ["android/**", "ios/**"],
59 | *
60 | * // override which node gets called and with what additional arguments
61 | * nodeExecutableAndArgs: ["node"]
62 | *
63 | * // supply additional arguments to the packager
64 | * extraPackagerArgs: []
65 | * ]
66 | */
67 |
68 | apply from: "../../node_modules/react-native/react.gradle"
69 |
70 | /**
71 | * Set this to true to create two separate APKs instead of one:
72 | * - An APK that only works on ARM devices
73 | * - An APK that only works on x86 devices
74 | * The advantage is the size of the APK is reduced by about 4MB.
75 | * Upload all the APKs to the Play Store and people will download
76 | * the correct one based on the CPU architecture of their device.
77 | */
78 | def enableSeparateBuildPerCPUArchitecture = false
79 |
80 | /**
81 | * Run Proguard to shrink the Java bytecode in release builds.
82 | */
83 | def enableProguardInReleaseBuilds = false
84 |
85 | android {
86 | compileSdkVersion 23
87 | buildToolsVersion "23.0.1"
88 |
89 | defaultConfig {
90 | applicationId "com.gmtcclient"
91 | minSdkVersion 16
92 | targetSdkVersion 22
93 | versionCode 1
94 | versionName "1.0"
95 | ndk {
96 | abiFilters "armeabi-v7a", "x86"
97 | }
98 | }
99 | splits {
100 | abi {
101 | reset()
102 | enable enableSeparateBuildPerCPUArchitecture
103 | universalApk false // If true, also generate a universal APK
104 | include "armeabi-v7a", "x86"
105 | }
106 | }
107 | buildTypes {
108 | release {
109 | minifyEnabled enableProguardInReleaseBuilds
110 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
111 | }
112 | }
113 | // applicationVariants are e.g. debug, release
114 | applicationVariants.all { variant ->
115 | variant.outputs.each { output ->
116 | // For each separate APK per architecture, set a unique version code as described here:
117 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
118 | def versionCodes = ["armeabi-v7a":1, "x86":2]
119 | def abi = output.getFilter(OutputFile.ABI)
120 | if (abi != null) { // null for the universal-debug, universal-release variants
121 | output.versionCodeOverride =
122 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
123 | }
124 | }
125 | }
126 | }
127 |
128 | dependencies {
129 | compile fileTree(dir: "libs", include: ["*.jar"])
130 | compile "com.android.support:appcompat-v7:23.0.1"
131 | compile "com.facebook.react:react-native:+" // From node_modules
132 | }
133 |
134 | // Run this once to be able to run the application with BUCK
135 | // puts all compile dependencies into folder libs for BUCK to use
136 | task copyDownloadableDepsToLibs(type: Copy) {
137 | from configurations.compile
138 | into 'libs'
139 | }
140 |
--------------------------------------------------------------------------------
/GmtcClient/src/components/ParallaxBackground.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 Facebook, Inc.
3 | *
4 | * You are hereby granted a non-exclusive, worldwide, royalty-free license to
5 | * use, copy, modify, and distribute this software in source code or binary
6 | * form for use in connection with the web services and APIs provided by
7 | * Facebook.
8 | *
9 | * As with any software that integrates with the Facebook platform, your use
10 | * of this software is subject to the Facebook Developer Principles and
11 | * Policies [http://developers.facebook.com/policy/]. This copyright notice
12 | * shall be included in all copies or substantial portions of the software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE
21 | *
22 | * @flow
23 | * @providesModule ParallaxBackground
24 | */
25 |
26 | 'use strict';
27 |
28 | var Animated = require('Animated');
29 | var resolveAssetSource = require('resolveAssetSource');
30 | var React = require('React');
31 | var StyleSheet = require('StyleSheet');
32 | var View = require('View');
33 | var Image = require('Image');
34 | var Dimensions = require('Dimensions');
35 |
36 | // TODO: Remove this magic numbers
37 | const HEIGHT = Dimensions.get('window').height > 600
38 | ? 200
39 | : 150;
40 | const SCREEN_WIDTH = Dimensions.get('window').width;
41 |
42 | type Props = {
43 | maxHeight: number;
44 | minHeight: number;
45 | offset: Animated.Value;
46 | backgroundImage: number;
47 | backgroundShift: number; // 0..1
48 | backgroundColor: string; // TODO: This makes it seems like image loads faster. Remove
49 | children?: any;
50 | }
51 |
52 | type State = {
53 | shift: Animated.Value;
54 | };
55 |
56 | class ParallaxBackground extends React.Component {
57 | props: Props;
58 | state: State;
59 |
60 | static HEIGHT = HEIGHT;
61 |
62 | constructor(props: Props) {
63 | super(props);
64 | this.state = {
65 | shift: new Animated.Value(props.backgroundShift || 0),
66 | };
67 | }
68 |
69 | componentDidUpdate(prevProps: Props) {
70 | if (prevProps.backgroundShift !== this.props.backgroundShift) {
71 | Animated.timing(this.state.shift, {
72 | toValue: this.props.backgroundShift,
73 | duration: 300,
74 | }).start();
75 | }
76 | }
77 |
78 | render(): ReactElement {
79 | const {minHeight, maxHeight, offset, backgroundColor} = this.props;
80 | const buffer = 10; // To reduce visual lag when scrolling
81 | const height = offset.interpolate({
82 | inputRange: [0, maxHeight - minHeight],
83 | outputRange: [maxHeight + buffer, minHeight + buffer],
84 | extrapolateRight: 'clamp',
85 | });
86 |
87 | return (
88 |
89 | {this.renderBackgroundImage()}
90 | {this.renderContent()}
91 |
92 | );
93 | }
94 |
95 | renderBackgroundImage(): ?ReactElement {
96 | const {backgroundImage, minHeight, maxHeight, offset} = this.props;
97 | if (!backgroundImage) {
98 | return null;
99 | }
100 |
101 | const source = resolveAssetSource(backgroundImage);
102 | if (!source) {
103 | return null;
104 | }
105 | const {width} = source;
106 | const translateX = this.state.shift.interpolate({
107 | inputRange: [0, 1],
108 | outputRange: [0, SCREEN_WIDTH - width],
109 | extrapolate: 'clamp',
110 | });
111 |
112 | const length = maxHeight - minHeight;
113 | const translateY = offset.interpolate({
114 | inputRange: [0, length / 2, length],
115 | outputRange: [0, -length / 2, -length / 1.5],
116 | extrapolate: 'clamp',
117 | });
118 | // Sometimes image width is smaller than device's width
119 | const initialScale = Math.max(SCREEN_WIDTH / width * 2 - 1, 1);
120 | const scale = offset.interpolate({
121 | inputRange: [-length, 0],
122 | outputRange: [2, initialScale],
123 | extrapolateRight: 'clamp',
124 | });
125 | const transforms = { transform: [{translateX}, {translateY}, {scale}] };
126 | return (
127 |
131 | );
132 | }
133 |
134 | renderContent(): ?ReactElement {
135 | if (React.Children.count(this.props.children) === 0) {
136 | return null;
137 | }
138 | const content = React.Children.only(this.props.children);
139 |
140 | const {minHeight, maxHeight, offset} = this.props;
141 | const length = maxHeight - minHeight;
142 | const opacity = offset.interpolate({
143 | inputRange: [0, length - 40],
144 | outputRange: [1, 0],
145 | extrapolate: 'clamp',
146 | });
147 | const translateY = offset.interpolate({
148 | inputRange: [0, length],
149 | outputRange: [-32, -(length / 2) - 32],
150 | extrapolate: 'clamp',
151 | });
152 | const transforms = { opacity, transform: [{translateY}] };
153 | return (
154 |
155 | {content}
156 |
157 | );
158 | }
159 | }
160 |
161 | var HEADER_HEIGHT = HEIGHT + 156;
162 |
163 | var styles = StyleSheet.create({
164 | container: {
165 | position: 'absolute',
166 | left: 0,
167 | top: 0,
168 | right: 0,
169 | overflow: 'hidden',
170 | },
171 | contentContainer: {
172 | position: 'absolute',
173 | left: 0,
174 | top: 0,
175 | right: 0,
176 | height: HEADER_HEIGHT,
177 | alignItems: 'center',
178 | justifyContent: 'center',
179 | backgroundColor: 'transparent',
180 | },
181 | });
182 |
183 |
184 | module.exports = ParallaxBackground;
185 |
--------------------------------------------------------------------------------
/server/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GIT
2 | remote: git://github.com/activeadmin/activeadmin.git
3 | revision: 0ac35b7ff05246c3bc143c74fab38c4fdc0e875b
4 | specs:
5 | activeadmin (1.0.0.pre2)
6 | arbre (~> 1.0, >= 1.0.2)
7 | bourbon
8 | coffee-rails
9 | formtastic (~> 3.1)
10 | formtastic_i18n
11 | inherited_resources (~> 1.6)
12 | jquery-rails
13 | jquery-ui-rails
14 | kaminari (~> 0.15)
15 | rails (>= 3.2, < 5.0)
16 | ransack (~> 1.3)
17 | sass-rails
18 | sprockets (< 4)
19 |
20 | GEM
21 | remote: https://rubygems.org/
22 | specs:
23 | actionmailer (4.2.6)
24 | actionpack (= 4.2.6)
25 | actionview (= 4.2.6)
26 | activejob (= 4.2.6)
27 | mail (~> 2.5, >= 2.5.4)
28 | rails-dom-testing (~> 1.0, >= 1.0.5)
29 | actionpack (4.2.6)
30 | actionview (= 4.2.6)
31 | activesupport (= 4.2.6)
32 | rack (~> 1.6)
33 | rack-test (~> 0.6.2)
34 | rails-dom-testing (~> 1.0, >= 1.0.5)
35 | rails-html-sanitizer (~> 1.0, >= 1.0.2)
36 | actionview (4.2.6)
37 | activesupport (= 4.2.6)
38 | builder (~> 3.1)
39 | erubis (~> 2.7.0)
40 | rails-dom-testing (~> 1.0, >= 1.0.5)
41 | rails-html-sanitizer (~> 1.0, >= 1.0.2)
42 | activejob (4.2.6)
43 | activesupport (= 4.2.6)
44 | globalid (>= 0.3.0)
45 | activemodel (4.2.6)
46 | activesupport (= 4.2.6)
47 | builder (~> 3.1)
48 | activerecord (4.2.6)
49 | activemodel (= 4.2.6)
50 | activesupport (= 4.2.6)
51 | arel (~> 6.0)
52 | activesupport (4.2.6)
53 | i18n (~> 0.7)
54 | json (~> 1.7, >= 1.7.7)
55 | minitest (~> 5.1)
56 | thread_safe (~> 0.3, >= 0.3.4)
57 | tzinfo (~> 1.1)
58 | arbre (1.0.3)
59 | activesupport (>= 3.0.0)
60 | arel (6.0.3)
61 | bcrypt (3.1.11)
62 | binding_of_caller (0.7.2)
63 | debug_inspector (>= 0.0.1)
64 | bourbon (4.2.7)
65 | sass (~> 3.4)
66 | thor (~> 0.19)
67 | builder (3.2.2)
68 | byebug (9.0.5)
69 | coderay (1.1.1)
70 | coffee-rails (4.1.1)
71 | coffee-script (>= 2.2.0)
72 | railties (>= 4.0.0, < 5.1.x)
73 | coffee-script (2.4.1)
74 | coffee-script-source
75 | execjs
76 | coffee-script-source (1.10.0)
77 | concurrent-ruby (1.0.2)
78 | debug_inspector (0.0.2)
79 | devise (3.5.10)
80 | bcrypt (~> 3.0)
81 | orm_adapter (~> 0.1)
82 | railties (>= 3.2.6, < 5)
83 | responders
84 | thread_safe (~> 0.1)
85 | warden (~> 1.2.3)
86 | diff-lcs (1.2.5)
87 | erubis (2.7.0)
88 | execjs (2.7.0)
89 | ffi (1.9.10)
90 | formatador (0.2.5)
91 | formtastic (3.1.4)
92 | actionpack (>= 3.2.13)
93 | formtastic_i18n (0.6.0)
94 | globalid (0.3.6)
95 | activesupport (>= 4.1.0)
96 | guard (2.14.0)
97 | formatador (>= 0.2.4)
98 | listen (>= 2.7, < 4.0)
99 | lumberjack (~> 1.0)
100 | nenv (~> 0.1)
101 | notiffany (~> 0.0)
102 | pry (>= 0.9.12)
103 | shellany (~> 0.0)
104 | thor (>= 0.18.1)
105 | guard-compat (1.2.1)
106 | guard-rspec (4.7.2)
107 | guard (~> 2.1)
108 | guard-compat (~> 1.1)
109 | rspec (>= 2.99.0, < 4.0)
110 | has_scope (0.6.0)
111 | actionpack (>= 3.2, < 5)
112 | activesupport (>= 3.2, < 5)
113 | hpricot (0.8.6)
114 | i18n (0.7.0)
115 | inherited_resources (1.6.0)
116 | actionpack (>= 3.2, < 5)
117 | has_scope (~> 0.6.0.rc)
118 | railties (>= 3.2, < 5)
119 | responders
120 | jbuilder (2.5.0)
121 | activesupport (>= 3.0.0, < 5.1)
122 | multi_json (~> 1.2)
123 | jquery-rails (4.1.1)
124 | rails-dom-testing (>= 1, < 3)
125 | railties (>= 4.2.0)
126 | thor (>= 0.14, < 2.0)
127 | jquery-ui-rails (5.0.5)
128 | railties (>= 3.2.16)
129 | json (1.8.3)
130 | kaminari (0.17.0)
131 | actionpack (>= 3.0.0)
132 | activesupport (>= 3.0.0)
133 | listen (3.1.5)
134 | rb-fsevent (~> 0.9, >= 0.9.4)
135 | rb-inotify (~> 0.9, >= 0.9.7)
136 | ruby_dep (~> 1.2)
137 | loofah (2.0.3)
138 | nokogiri (>= 1.5.9)
139 | lumberjack (1.0.10)
140 | mail (2.6.4)
141 | mime-types (>= 1.16, < 4)
142 | method_source (0.8.2)
143 | mime-types (3.1)
144 | mime-types-data (~> 3.2015)
145 | mime-types-data (3.2016.0521)
146 | mini_portile2 (2.1.0)
147 | minitest (5.9.0)
148 | multi_json (1.12.1)
149 | nenv (0.3.0)
150 | nokogiri (1.6.8)
151 | mini_portile2 (~> 2.1.0)
152 | pkg-config (~> 1.1.7)
153 | notiffany (0.1.0)
154 | nenv (~> 0.1)
155 | shellany (~> 0.0)
156 | orm_adapter (0.5.0)
157 | pkg-config (1.1.7)
158 | polyamorous (1.3.0)
159 | activerecord (>= 3.0)
160 | pry (0.10.3)
161 | coderay (~> 1.1.0)
162 | method_source (~> 0.8.1)
163 | slop (~> 3.4)
164 | rack (1.6.4)
165 | rack-test (0.6.3)
166 | rack (>= 1.0)
167 | rails (4.2.6)
168 | actionmailer (= 4.2.6)
169 | actionpack (= 4.2.6)
170 | actionview (= 4.2.6)
171 | activejob (= 4.2.6)
172 | activemodel (= 4.2.6)
173 | activerecord (= 4.2.6)
174 | activesupport (= 4.2.6)
175 | bundler (>= 1.3.0, < 2.0)
176 | railties (= 4.2.6)
177 | sprockets-rails
178 | rails-deprecated_sanitizer (1.0.3)
179 | activesupport (>= 4.2.0.alpha)
180 | rails-dom-testing (1.0.7)
181 | activesupport (>= 4.2.0.beta, < 5.0)
182 | nokogiri (~> 1.6.0)
183 | rails-deprecated_sanitizer (>= 1.0.1)
184 | rails-html-sanitizer (1.0.3)
185 | loofah (~> 2.0)
186 | railties (4.2.6)
187 | actionpack (= 4.2.6)
188 | activesupport (= 4.2.6)
189 | rake (>= 0.8.7)
190 | thor (>= 0.18.1, < 2.0)
191 | rake (11.2.2)
192 | ransack (1.7.0)
193 | actionpack (>= 3.0)
194 | activerecord (>= 3.0)
195 | activesupport (>= 3.0)
196 | i18n
197 | polyamorous (~> 1.2)
198 | rb-fsevent (0.9.7)
199 | rb-inotify (0.9.7)
200 | ffi (>= 0.5.0)
201 | rdoc (4.2.2)
202 | json (~> 1.4)
203 | responders (2.2.0)
204 | railties (>= 4.2.0, < 5.1)
205 | rspec (3.4.0)
206 | rspec-core (~> 3.4.0)
207 | rspec-expectations (~> 3.4.0)
208 | rspec-mocks (~> 3.4.0)
209 | rspec-core (3.4.4)
210 | rspec-support (~> 3.4.0)
211 | rspec-expectations (3.4.0)
212 | diff-lcs (>= 1.2.0, < 2.0)
213 | rspec-support (~> 3.4.0)
214 | rspec-mocks (3.4.1)
215 | diff-lcs (>= 1.2.0, < 2.0)
216 | rspec-support (~> 3.4.0)
217 | rspec-rails (3.4.2)
218 | actionpack (>= 3.0, < 4.3)
219 | activesupport (>= 3.0, < 4.3)
220 | railties (>= 3.0, < 4.3)
221 | rspec-core (~> 3.4.0)
222 | rspec-expectations (~> 3.4.0)
223 | rspec-mocks (~> 3.4.0)
224 | rspec-support (~> 3.4.0)
225 | rspec-support (3.4.1)
226 | ruby_dep (1.3.1)
227 | sass (3.4.22)
228 | sass-rails (5.0.4)
229 | railties (>= 4.0.0, < 5.0)
230 | sass (~> 3.1)
231 | sprockets (>= 2.8, < 4.0)
232 | sprockets-rails (>= 2.0, < 4.0)
233 | tilt (>= 1.1, < 3)
234 | sdoc (0.4.1)
235 | json (~> 1.7, >= 1.7.7)
236 | rdoc (~> 4.0)
237 | shellany (0.0.1)
238 | slop (3.6.0)
239 | spring (1.7.1)
240 | sprockets (3.6.2)
241 | concurrent-ruby (~> 1.0)
242 | rack (> 1, < 3)
243 | sprockets-rails (3.0.4)
244 | actionpack (>= 4.0)
245 | activesupport (>= 4.0)
246 | sprockets (>= 3.0.0)
247 | sqlite3 (1.3.11)
248 | thor (0.19.1)
249 | thread_safe (0.3.5)
250 | tilt (2.0.5)
251 | turbolinks (2.5.3)
252 | coffee-rails
253 | tzinfo (1.2.2)
254 | thread_safe (~> 0.1)
255 | uglifier (3.0.0)
256 | execjs (>= 0.3.0, < 3)
257 | warden (1.2.6)
258 | rack (>= 1.0)
259 | web-console (2.3.0)
260 | activemodel (>= 4.0)
261 | binding_of_caller (>= 0.7.2)
262 | railties (>= 4.0)
263 | sprockets-rails (>= 2.0, < 4.0)
264 |
265 | PLATFORMS
266 | ruby
267 |
268 | DEPENDENCIES
269 | activeadmin!
270 | byebug
271 | coffee-rails (~> 4.1.0)
272 | devise
273 | guard-rspec
274 | hpricot
275 | jbuilder (~> 2.0)
276 | jquery-rails
277 | rails (= 4.2.6)
278 | rspec-rails
279 | sass-rails (~> 5.0)
280 | sdoc (~> 0.4.0)
281 | spring
282 | sqlite3
283 | turbolinks
284 | uglifier (>= 1.3.0)
285 | web-console (~> 2.0)
286 |
287 | BUNDLED WITH
288 | 1.12.5
289 |
--------------------------------------------------------------------------------
/server/config/initializers/active_admin.rb:
--------------------------------------------------------------------------------
1 | ActiveAdmin.setup do |config|
2 | # == Site Title
3 | #
4 | # Set the title that is displayed on the main layout
5 | # for each of the active admin pages.
6 | #
7 | config.site_title = "Server"
8 |
9 | # Set the link url for the title. For example, to take
10 | # users to your main site. Defaults to no link.
11 | #
12 | # config.site_title_link = "/"
13 |
14 | # Set an optional image to be displayed for the header
15 | # instead of a string (overrides :site_title)
16 | #
17 | # Note: Aim for an image that's 21px high so it fits in the header.
18 | #
19 | # config.site_title_image = "logo.png"
20 |
21 | # == Default Namespace
22 | #
23 | # Set the default namespace each administration resource
24 | # will be added to.
25 | #
26 | # eg:
27 | # config.default_namespace = :hello_world
28 | #
29 | # This will create resources in the HelloWorld module and
30 | # will namespace routes to /hello_world/*
31 | #
32 | # To set no namespace by default, use:
33 | # config.default_namespace = false
34 | #
35 | # Default:
36 | # config.default_namespace = :admin
37 | #
38 | # You can customize the settings for each namespace by using
39 | # a namespace block. For example, to change the site title
40 | # within a namespace:
41 | #
42 | # config.namespace :admin do |admin|
43 | # admin.site_title = "Custom Admin Title"
44 | # end
45 | #
46 | # This will ONLY change the title for the admin section. Other
47 | # namespaces will continue to use the main "site_title" configuration.
48 |
49 | # == User Authentication
50 | #
51 | # Active Admin will automatically call an authentication
52 | # method in a before filter of all controller actions to
53 | # ensure that there is a currently logged in admin user.
54 | #
55 | # This setting changes the method which Active Admin calls
56 | # within the application controller.
57 | config.authentication_method = :authenticate_admin_user!
58 |
59 | # == User Authorization
60 | #
61 | # Active Admin will automatically call an authorization
62 | # method in a before filter of all controller actions to
63 | # ensure that there is a user with proper rights. You can use
64 | # CanCanAdapter or make your own. Please refer to documentation.
65 | # config.authorization_adapter = ActiveAdmin::CanCanAdapter
66 |
67 | # In case you prefer Pundit over other solutions you can here pass
68 | # the name of default policy class. This policy will be used in every
69 | # case when Pundit is unable to find suitable policy.
70 | # config.pundit_default_policy = "MyDefaultPunditPolicy"
71 |
72 | # You can customize your CanCan Ability class name here.
73 | # config.cancan_ability_class = "Ability"
74 |
75 | # You can specify a method to be called on unauthorized access.
76 | # This is necessary in order to prevent a redirect loop which happens
77 | # because, by default, user gets redirected to Dashboard. If user
78 | # doesn't have access to Dashboard, he'll end up in a redirect loop.
79 | # Method provided here should be defined in application_controller.rb.
80 | # config.on_unauthorized_access = :access_denied
81 |
82 | # == Current User
83 | #
84 | # Active Admin will associate actions with the current
85 | # user performing them.
86 | #
87 | # This setting changes the method which Active Admin calls
88 | # (within the application controller) to return the currently logged in user.
89 | config.current_user_method = :current_admin_user
90 |
91 | # == Logging Out
92 | #
93 | # Active Admin displays a logout link on each screen. These
94 | # settings configure the location and method used for the link.
95 | #
96 | # This setting changes the path where the link points to. If it's
97 | # a string, the strings is used as the path. If it's a Symbol, we
98 | # will call the method to return the path.
99 | #
100 | # Default:
101 | config.logout_link_path = :destroy_admin_user_session_path
102 |
103 | # This setting changes the http method used when rendering the
104 | # link. For example :get, :delete, :put, etc..
105 | #
106 | # Default:
107 | # config.logout_link_method = :get
108 |
109 | # == Root
110 | #
111 | # Set the action to call for the root path. You can set different
112 | # roots for each namespace.
113 | #
114 | # Default:
115 | # config.root_to = 'dashboard#index'
116 |
117 | # == Admin Comments
118 | #
119 | # This allows your users to comment on any resource registered with Active Admin.
120 | #
121 | # You can completely disable comments:
122 | # config.comments = false
123 | #
124 | # You can change the name under which comments are registered:
125 | # config.comments_registration_name = 'AdminComment'
126 | #
127 | # You can change the order for the comments and you can change the column
128 | # to be used for ordering:
129 | # config.comments_order = 'created_at ASC'
130 | #
131 | # You can disable the menu item for the comments index page:
132 | # config.comments_menu = false
133 | #
134 | # You can customize the comment menu:
135 | # config.comments_menu = { parent: 'Admin', priority: 1 }
136 |
137 | # == Batch Actions
138 | #
139 | # Enable and disable Batch Actions
140 | #
141 | config.batch_actions = true
142 |
143 | # == Controller Filters
144 | #
145 | # You can add before, after and around filters to all of your
146 | # Active Admin resources and pages from here.
147 | #
148 | # config.before_filter :do_something_awesome
149 |
150 | # == Localize Date/Time Format
151 | #
152 | # Set the localize format to display dates and times.
153 | # To understand how to localize your app with I18n, read more at
154 | # https://github.com/svenfuchs/i18n/blob/master/lib%2Fi18n%2Fbackend%2Fbase.rb#L52
155 | #
156 | config.localize_format = :long
157 |
158 | # == Setting a Favicon
159 | #
160 | # config.favicon = 'favicon.ico'
161 |
162 | # == Meta Tags
163 | #
164 | # Add additional meta tags to the head element of active admin pages.
165 | #
166 | # Add tags to all pages logged in users see:
167 | # config.meta_tags = { author: 'My Company' }
168 |
169 | # By default, sign up/sign in/recover password pages are excluded
170 | # from showing up in search engine results by adding a robots meta
171 | # tag. You can reset the hash of meta tags included in logged out
172 | # pages:
173 | # config.meta_tags_for_logged_out_pages = {}
174 |
175 | # == Removing Breadcrumbs
176 | #
177 | # Breadcrumbs are enabled by default. You can customize them for individual
178 | # resources or you can disable them globally from here.
179 | #
180 | # config.breadcrumb = false
181 |
182 | # == Register Stylesheets & Javascripts
183 | #
184 | # We recommend using the built in Active Admin layout and loading
185 | # up your own stylesheets / javascripts to customize the look
186 | # and feel.
187 | #
188 | # To load a stylesheet:
189 | # config.register_stylesheet 'my_stylesheet.css'
190 | #
191 | # You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
192 | # config.register_stylesheet 'my_print_stylesheet.css', media: :print
193 | #
194 | # To load a javascript file:
195 | # config.register_javascript 'my_javascript.js'
196 |
197 | # == CSV options
198 | #
199 | # Set the CSV builder separator
200 | # config.csv_options = { col_sep: ';' }
201 | #
202 | # Force the use of quotes
203 | # config.csv_options = { force_quotes: true }
204 |
205 | # == Menu System
206 | #
207 | # You can add a navigation menu to be used in your application, or configure a provided menu
208 | #
209 | # To change the default utility navigation to show a link to your website & a logout btn
210 | #
211 | # config.namespace :admin do |admin|
212 | # admin.build_menu :utility_navigation do |menu|
213 | # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
214 | # admin.add_logout_button_to_menu menu
215 | # end
216 | # end
217 | #
218 | # If you wanted to add a static menu item to the default menu provided:
219 | #
220 | # config.namespace :admin do |admin|
221 | # admin.build_menu :default do |menu|
222 | # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
223 | # end
224 | # end
225 |
226 | # == Download Links
227 | #
228 | # You can disable download links on resource listing pages,
229 | # or customize the formats shown per namespace/globally
230 | #
231 | # To disable/customize for the :admin namespace:
232 | #
233 | # config.namespace :admin do |admin|
234 | #
235 | # # Disable the links entirely
236 | # admin.download_links = false
237 | #
238 | # # Only show XML & PDF options
239 | # admin.download_links = [:xml, :pdf]
240 | #
241 | # # Enable/disable the links based on block
242 | # # (for example, with cancan)
243 | # admin.download_links = proc { can?(:view_download_links) }
244 | #
245 | # end
246 |
247 | # == Pagination
248 | #
249 | # Pagination is enabled by default for all resources.
250 | # You can control the default per page count for all resources here.
251 | #
252 | # config.default_per_page = 30
253 | #
254 | # You can control the max per page count too.
255 | #
256 | # config.max_per_page = 10_000
257 |
258 | # == Filters
259 | #
260 | # By default the index screen includes a "Filters" sidebar on the right
261 | # hand side with a filter for each attribute of the registered model.
262 | # You can enable or disable them for all resources here.
263 | #
264 | # config.filters = true
265 | #
266 | # By default the filters include associations in a select, which means
267 | # that every record will be loaded for each association.
268 | # You can enabled or disable the inclusion
269 | # of those filters by default here.
270 | #
271 | # config.include_default_association_filters = true
272 | end
273 |
--------------------------------------------------------------------------------
/GmtcClient/src/components/ListContainer.js:
--------------------------------------------------------------------------------
1 | var ParallaxBackground = require('ParallaxBackground')
2 | var React = require('React')
3 | var ReactNative = require('react-native')
4 | var ViewPager = require('./ViewPager')
5 | var Platform = require('Platform')
6 | import SegmentTab from './SegmentTab'
7 | import {STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT} from '../App'
8 | import {
9 | Text,
10 | View,
11 | Dimensions,
12 | NativeModules,
13 | Animated,
14 | StyleSheet
15 | } from 'react-native'
16 |
17 | type Props = {
18 | title: string;
19 | selectedSegment?: number;
20 | selectedSectionColor: string;
21 | backgroundImage: number;
22 | backgroundColor: string;
23 | parallaxContent?: ?ReactElement;
24 | stickyHeader?: ?ReactElement;
25 | onSegmentChange?: (segment: number) => void;
26 | needTransitionTitle: bool;
27 | children?: any;
28 | };
29 |
30 | type State = {
31 | idx: number;
32 | anim: Animated.Value;
33 | stickyHeaderHeight: number;
34 | };
35 |
36 | export const EMPTY_CELL_HEIGHT = Dimensions.get('window').height > 600 ? 200 : 150
37 |
38 | export default class extends React.Component {
39 | props: Props;
40 | state: State;
41 | _refs: Array;
42 | _pinned: any;
43 |
44 | static defaultProps = {
45 | selectedSectionColor: 'rgba(255,255,255,0.5)',
46 | needTransitionTitle: false
47 | };
48 |
49 | constructor (props: Props) {
50 | super(props)
51 |
52 | this.state = {
53 | idx: this.props.selectedSegment || 0,
54 | anim: new Animated.Value(0),
55 | stickyHeaderHeight: 0
56 | };
57 |
58 | (this: any).renderFakeHeader = this.renderFakeHeader.bind(this);
59 | (this: any).handleStickyHeaderLayout = this.handleStickyHeaderLayout.bind(this);
60 | (this: any).handleSelectSegment = this.handleSelectSegment.bind(this)
61 | this._refs = []
62 | }
63 |
64 | render () {
65 | const segments = []
66 | const content = React.Children.map(this.props.children, (child, idx) => {
67 | segments.push(child.props.title)
68 | return React.cloneElement(child, {
69 | ref: (ref) => { this._refs[idx] = ref },
70 | onScroll: (e) => this.handleScroll(idx, e),
71 | style: styles.listView,
72 | showsVerticalScrollIndicator: false,
73 | scrollEventThrottle: 16,
74 | contentInset: {bottom: 49, top: 0},
75 | automaticallyAdjustContentInsets: false,
76 | renderHeader: this.renderFakeHeader,
77 | scrollsToTop: idx === this.state.idx
78 | })
79 | })
80 |
81 | // segments 的指示器
82 | let {stickyHeader} = this.props
83 | let assistantHeight = STATUS_BAR_HEIGHT + NAV_BAR_HEIGHT
84 | if (segments.length > 1) {
85 | assistantHeight = STATUS_BAR_HEIGHT
86 | stickyHeader = (
87 |
88 |
98 | {stickyHeader}
99 |
100 | )
101 | }
102 | // TODO: Bind to ViewPager animation
103 | const backgroundShift = segments.length === 1
104 | ? 0
105 | : this.state.idx / (segments.length - 1)
106 | return (
107 |
108 |
109 |
116 | {this.renderParallaxContent()}
117 |
118 |
119 | {this.renderHeaderTitle()}
120 |
121 | {this.renderFixedStickyHeader(stickyHeader)}
122 |
123 |
127 | {content}
128 |
129 | {this.renderFloatingStickyHeader(stickyHeader)}
130 |
131 | )
132 | }
133 |
134 | renderParallaxContent () {
135 | if (this.props.parallaxContent) {
136 | return this.props.parallaxContent
137 | }
138 | return (
139 |
140 | {this.props.title}
141 |
142 | )
143 | }
144 |
145 | renderHeaderTitle (): ?ReactElement { // 导航条标题,有伸缩视图时标题常驻,没有则逐渐出现
146 | var transform
147 | if (!this.props.parallaxContent || Platform.OS === 'ios' && this.props.needTransitionTitle) {
148 | var distance = EMPTY_CELL_HEIGHT - this.state.stickyHeaderHeight
149 | transform = {
150 | opacity: this.state.anim.interpolate({
151 | inputRange: [distance - 20, distance],
152 | outputRange: [0, 1],
153 | extrapolate: 'clamp'
154 | })
155 | }
156 | }
157 | return (
158 |
159 | {this.props.title}
160 |
161 | )
162 | }
163 |
164 | handleScroll (idx: number, e: any) {
165 | if (idx !== this.state.idx) {
166 | return
167 | }
168 | let y = 0
169 | if (Platform.OS === 'ios') {
170 | this.state.anim.setValue(e.nativeEvent.contentOffset.y)
171 | const height = EMPTY_CELL_HEIGHT - this.state.stickyHeaderHeight
172 | y = Math.min(e.nativeEvent.contentOffset.y, height)
173 | }
174 | this._refs.forEach((ref, ii) => { // 同步其他几个segmentListView的滑动高度
175 | if (ii !== idx && ref) {
176 | ref.scrollTo && ref.scrollTo({y, animated: false})
177 | }
178 | })
179 | }
180 |
181 | renderFakeHeader () { // 给ListView渲染假头部
182 | if (Platform.OS === 'ios') {
183 | const height = EMPTY_CELL_HEIGHT - this.state.stickyHeaderHeight
184 | return (
185 |
186 | )
187 | }
188 | }
189 |
190 | renderFixedStickyHeader (stickyHeader: ?ReactElement) {
191 | return
192 | }
193 |
194 | renderFloatingStickyHeader (stickyHeader: ?ReactElement) {
195 | if (!stickyHeader || Platform.OS !== 'ios') {
196 | return
197 | }
198 | var opacity = this.state.stickyHeaderHeight === 0 ? 0 : 1
199 | var transform
200 |
201 | if (!NativeModules.F8Scrolling) {
202 | var distance = EMPTY_CELL_HEIGHT - this.state.stickyHeaderHeight;
203 | var translateY = this.state.anim.interpolate({
204 | inputRange: [0, distance],
205 | outputRange: [distance, 0],
206 | extrapolateRight: 'clamp',
207 | });
208 | transform = [{translateY}];
209 | }
210 | return (
211 | { this._pinned = ref }}
213 | onLayout={this.handleStickyHeaderLayout}
214 | style={[styles.stickyHeader, {opacity}, {transform}]}>
215 | {stickyHeader}
216 |
217 | )
218 | }
219 |
220 | handleStickyHeaderLayout ({nativeEvent: { layout, target }}: any) {
221 | this.setState({stickyHeaderHeight: layout.height})
222 | }
223 |
224 | componentWillReceiveProps (nextProps: Props) { // 点击切换segment
225 | if (typeof nextProps.selectedSegment === 'number' &&
226 | nextProps.selectedSegment !== this.state.idx) {
227 | this.setState({idx: nextProps.selectedSegment})
228 | }
229 | }
230 |
231 | componentDidUpdate (prevProps: Props, prevState: State) {
232 | if (!NativeModules.F8Scrolling) {
233 | return
234 | }
235 | if (this.state.idx !== prevState.idx ||
236 | this.state.stickyHeaderHeight !== prevState.stickyHeaderHeight) {
237 | var distance = EMPTY_CELL_HEIGHT - this.state.stickyHeaderHeight
238 |
239 | if (this._refs[prevState.idx] && this._refs[prevState.idx].getScrollResponder) {
240 | const oldScrollViewTag = ReactNative.findNodeHandle(
241 | this._refs[prevState.idx].getScrollResponder()
242 | )
243 | NativeModules.F8Scrolling.unpin(oldScrollViewTag)
244 | }
245 |
246 | if (this._refs[this.state.idx] && this._refs[this.state.idx].getScrollResponder) {
247 | const newScrollViewTag = ReactNative.findNodeHandle(
248 | this._refs[this.state.idx].getScrollResponder()
249 | )
250 | const pinnedViewTag = ReactNative.findNodeHandle(this._pinned)
251 | NativeModules.F8Scrolling.pin(newScrollViewTag, pinnedViewTag, distance)
252 | }
253 | }
254 | }
255 |
256 | handleSelectSegment (idx: number) {
257 | if (this.state.idx !== idx) {
258 | const {onSegmentChange} = this.props
259 | this.setState({idx}, () => onSegmentChange && onSegmentChange(idx))
260 | }
261 | }
262 | }
263 |
264 | var styles = StyleSheet.create({
265 | container: {
266 | flex: 1,
267 | backgroundColor: 'white'
268 | },
269 | headerWrapper: {
270 | backgroundColor: 'transparent',
271 | // FIXME: elevation doesn't seem to work without setting border
272 | borderRightWidth: 1,
273 | marginRight: -1,
274 | borderRightColor: 'transparent'
275 | },
276 | headerTitle: {
277 | color: 'white',
278 | fontWeight: 'bold',
279 | fontSize: 19
280 | },
281 | parallaxText: {
282 | color: 'white',
283 | fontSize: 42,
284 | fontWeight: 'bold',
285 | letterSpacing: -1
286 | },
287 | stickyHeader: {
288 | position: 'absolute',
289 | top: 64,
290 | left: 0,
291 | right: 0
292 | }
293 | })
294 |
--------------------------------------------------------------------------------