This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'representable/json' | |
| require 'representable/json/collection' | |
| # representers | |
| module StudentProgressRepresenter | |
| include Representable::JSON | |
| property :id | |
| collection :precinct_progresses#, extend: PrecinctProgressRepresenter, class: PrecinctProgress | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #timeline.timeline-container | |
| - @conversation.messages.each do |message| | |
| %article.timeline-entry | |
| %p= message.body | |
| = form_for [@conversation, @form], html: { style: 'overflow: hidden' } do |f| | |
| = f.text_area :body, placeholder: "Type your message here ...", rows: 5 | |
| = f.button "Send", type: :submit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Bid < ActiveRecord::Base | |
| class Create < Trailblazer::Operation | |
| include CRUD | |
| model Bid, :create | |
| contract do | |
| model Bid | |
| property :approved | |
| property :creator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Message < ActiveRecord::Base | |
| class Create < Trailblazer::Operation | |
| include CRUD | |
| model Message, :create | |
| builds do |params| | |
| System if params[:conversation].messages.empty? | |
| end | |
| contract do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AfterSignupController < ApplicationController | |
| include Wicked::Wizard | |
| steps :create_organization, :create_event, :create_tiers | |
| def show | |
| case step | |
| when :create_organization | |
| @form = Form::Organization.new(Organization.new) | |
| when :create_event | |
| @form = Form::Event.new(Event.new) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class EventsController < ApplicationController | |
| def index | |
| @events = Event.all | |
| end | |
| def show | |
| @event = Event.find(params[:id]) | |
| end | |
| def new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController < ActionController::Base | |
| # Prevent CSRF attacks by raising an exception. | |
| # For APIs, you may want to use :null_session instead. | |
| protect_from_forgery with: :exception | |
| before_action :authorize_user! | |
| protected | |
| def authorize_user! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'test_helper' | |
| describe Lotus::Model::Adapters::FileSystemAdapter do | |
| before do | |
| TestUser = Struct.new(:id, :name, :age) do | |
| include Lotus::Entity | |
| end | |
| class TestUserRepository | |
| include Lotus::Repository |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Api | |
| module V1 | |
| class AnswerController < ApplicationController | |
| respond_to :json | |
| def create | |
| lesson_session.process_attempts(params[:attempts].values) | |
| API::ProcessAnswer.new(lesson_session, current_student).call if lesson_session.completed? | |
| render json: {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class School < ActiveRecord::Base | |
| has_many :students | |
| has_many :teachers | |
| def to_param | |
| "#{id}-#{name.parameterize}" | |
| end | |
| def to_s | |
| name |