diff --git a/.gitignore b/.gitignore
index 42c035fe..f099387d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,4 +16,7 @@ rerun.txt
pickle-email-*.html
config/database.yml
+.env
+latest.dump
+download_db.sh
diff --git a/.ruby-version b/.ruby-version
index c031dda5..005119ba 100644
--- a/.ruby-version
+++ b/.ruby-version
@@ -1 +1 @@
-2.0.0-p0
+2.4.1
diff --git a/.rvmrc b/.rvmrc
deleted file mode 100644
index d51fd96e..00000000
--- a/.rvmrc
+++ /dev/null
@@ -1,2 +0,0 @@
-rvm_gemset_create_on_use_flag=1
-rvm use ruby-2.0.0@eurucamp_activities
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..d92f755e
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,10 @@
+sudo: false
+branches:
+ only:
+ - master
+cache: bundler
+before_script: cp config/database.yml.sample config/database.yml
+language: ruby
+rvm:
+ - 2.3.3
+script: bundle exec rake db:create db:migrate spec
diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 100644
index 00000000..83663514
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1,16 @@
+eurucamp Activities App
+
+Copyright (C) 2013 - 2014 Ruby Berlin e.V.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .
diff --git a/GNU-AGPL-3.0 b/GNU-AGPL-3.0
new file mode 100644
index 00000000..dba13ed2
--- /dev/null
+++ b/GNU-AGPL-3.0
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/Gemfile b/Gemfile
index 8a9951ea..63082458 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,45 +1,56 @@
source 'https://rubygems.org'
-ruby "2.0.0"
-
-gem 'rails', '4.0.0.beta1'
+gem 'rails', '5.0.1'
gem 'pg'
gem 'unicorn'
gem 'settingslogic'
gem 'newrelic_rpm'
+gem 'devise', '~> 4.2.0'
+gem 'omniauth', '~> 1.6.1'
+gem 'omniauth-github'
+gem 'omniauth-twitter'
+gem 'simple_form', '~> 3.4.0'
+gem 'dotenv-rails'
+gem 'modernizr-rails'
+gem 'sprockets-rails', '~> 3.2.0'
gem 'jquery-rails'
-# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
-# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
-gem 'jbuilder', '~> 1.0.1'
-# To use ActiveModel has_secure_password
-# gem 'bcrypt-ruby', '~> 3.0.0'
+gem 'jbuilder', '~> 1.0.1'
gem 'bourbon'
-gem 'neat'
gem 'haml-rails'
+gem 'rails_html_helpers'
+gem 'draper', '~> 3.0.0.pre1'
+gem 'cancan'
+gem 'redcarpet'
+gem 'sass-rails', '~> 5.0.6'
+gem 'coffee-rails', '~> 4.2.1'
+gem 'uglifier', '>= 1.0.3'
+
+gem 'activemodel-serializers-xml'
group :development do
- gem 'debugger', '~> 1.5'
- gem 'heroku_san', '~> 3.0.2'
gem 'foreman'
gem 'better_errors'
gem 'binding_of_caller'
end
-group :test do
- gem 'turn', require: false
- gem 'simplecov', require: false
+group :test, :development do
+ gem 'rspec-rails', '~> 3.3'
+ gem 'factory_girl_rails','~> 4.2'
end
-group :assets do
- gem 'sass-rails', '~> 4.0.0.beta1'
- gem 'coffee-rails', '~> 4.0.0.beta1'
- gem 'uglifier', '>= 1.0.3'
+group :test do
+ gem 'rails-controller-testing'
+ gem 'rspec-its'
+ gem 'rspec-activemodel-mocks'
+ gem 'simplecov', require: false
+ gem 'capybara', '~> 2.1'
+ gem 'accept_values_for'
+ gem 'json_spec'
end
group :production, :staging do
- # git version for rails-4.x compatibility
- gem 'exception_notification', require: 'exception_notifier', git: 'git://github.com/smartinez87/exception_notification.git'
- gem 'rack-robotz', '~> 0.0.3'
+ gem 'exception_notification', '~> 4.0.1'
+ gem 'rack-robotz', '~> 0.0.3'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 194fee0a..0bda513f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,210 +1,354 @@
-GIT
- remote: git://github.com/smartinez87/exception_notification.git
- revision: 6026c274d284def545cda9bfed8dcbc3964ae08f
- specs:
- exception_notification (3.0.1)
- actionmailer (>= 3.0.4)
- activesupport (>= 3.0.4)
-
GEM
remote: https://rubygems.org/
specs:
- actionmailer (4.0.0.beta1)
- actionpack (= 4.0.0.beta1)
- mail (~> 2.5.3)
- actionpack (4.0.0.beta1)
- activesupport (= 4.0.0.beta1)
- builder (~> 3.1.0)
+ accept_values_for (0.7.3)
+ activemodel (>= 4.2, < 5.1)
+ rspec (>= 2.0, < 4.0)
+ actioncable (5.0.1)
+ actionpack (= 5.0.1)
+ nio4r (~> 1.2)
+ websocket-driver (~> 0.6.1)
+ actionmailer (5.0.1)
+ actionpack (= 5.0.1)
+ actionview (= 5.0.1)
+ activejob (= 5.0.1)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 2.0)
+ actionpack (5.0.1)
+ actionview (= 5.0.1)
+ activesupport (= 5.0.1)
+ rack (~> 2.0)
+ rack-test (~> 0.6.3)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (5.0.1)
+ activesupport (= 5.0.1)
+ builder (~> 3.1)
erubis (~> 2.7.0)
- rack (~> 1.5.2)
- rack-test (~> 0.6.2)
- activemodel (4.0.0.beta1)
- activesupport (= 4.0.0.beta1)
- builder (~> 3.1.0)
- activerecord (4.0.0.beta1)
- activemodel (= 4.0.0.beta1)
- activerecord-deprecated_finders (~> 0.0.3)
- activesupport (= 4.0.0.beta1)
- arel (~> 4.0.0.beta1)
- activerecord-deprecated_finders (0.0.3)
- activesupport (4.0.0.beta1)
- i18n (~> 0.6.2)
- minitest (~> 4.2)
- multi_json (~> 1.3)
- thread_safe (~> 0.1)
- tzinfo (~> 0.3.33)
- addressable (2.3.4)
- ansi (1.4.3)
- arel (4.0.0)
- atomic (1.1.8)
- better_errors (0.8.0)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ activejob (5.0.1)
+ activesupport (= 5.0.1)
+ globalid (>= 0.3.6)
+ activemodel (5.0.1)
+ activesupport (= 5.0.1)
+ activemodel-serializers-xml (1.0.1)
+ activemodel (> 5.x)
+ activerecord (> 5.x)
+ activesupport (> 5.x)
+ builder (~> 3.1)
+ activerecord (5.0.1)
+ activemodel (= 5.0.1)
+ activesupport (= 5.0.1)
+ arel (~> 7.0)
+ activesupport (5.0.1)
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ i18n (~> 0.7)
+ minitest (~> 5.1)
+ tzinfo (~> 1.1)
+ addressable (2.5.0)
+ public_suffix (~> 2.0, >= 2.0.2)
+ arel (7.1.4)
+ bcrypt (3.1.11)
+ better_errors (2.1.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
- binding_of_caller (0.7.1)
+ rack (>= 0.9.0)
+ binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
- bourbon (3.1.5)
- sass (>= 3.2.0)
- thor
- builder (3.1.4)
- coderay (1.0.9)
- coffee-rails (4.0.0)
+ bourbon (5.0.0)
+ sass (~> 3.4)
+ thor (~> 0.19)
+ builder (3.2.3)
+ cancan (1.6.10)
+ capybara (2.12.1)
+ addressable
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ xpath (~> 2.0)
+ coderay (1.1.1)
+ coffee-rails (4.2.1)
coffee-script (>= 2.2.0)
- railties (>= 4.0.0.beta, < 5.0)
- coffee-script (2.2.0)
+ railties (>= 4.0.0, < 5.2.x)
+ coffee-script (2.4.1)
coffee-script-source
execjs
- coffee-script-source (1.6.2)
- columnize (0.3.6)
+ coffee-script-source (1.12.2)
+ concurrent-ruby (1.0.5)
debug_inspector (0.0.2)
- debugger (1.5.0)
- columnize (>= 0.3.1)
- debugger-linecache (~> 1.2.0)
- debugger-ruby_core_source (~> 1.2.0)
- debugger-linecache (1.2.0)
- debugger-ruby_core_source (1.2.0)
- dotenv (0.7.0)
+ devise (4.2.0)
+ bcrypt (~> 3.0)
+ orm_adapter (~> 0.1)
+ railties (>= 4.1.0, < 5.1)
+ responders
+ warden (~> 1.2.3)
+ diff-lcs (1.3)
+ docile (1.1.5)
+ dotenv (2.2.0)
+ dotenv-rails (2.2.0)
+ dotenv (= 2.2.0)
+ railties (>= 3.2, < 5.1)
+ draper (3.0.0.pre1)
+ actionpack (~> 5.0)
+ activemodel (~> 5.0)
+ activemodel-serializers-xml (~> 1.0)
+ activesupport (~> 5.0)
+ request_store (~> 1.0)
erubis (2.7.0)
- excon (0.20.1)
- execjs (1.4.0)
- multi_json (~> 1.0)
- foreman (0.63.0)
- dotenv (>= 0.7)
- thor (>= 0.13.6)
- haml (4.0.2)
+ exception_notification (4.0.1)
+ actionmailer (>= 3.0.4)
+ activesupport (>= 3.0.4)
+ execjs (2.7.0)
+ factory_girl (4.8.0)
+ activesupport (>= 3.0.0)
+ factory_girl_rails (4.8.0)
+ factory_girl (~> 4.8.0)
+ railties (>= 3.0.0)
+ faraday (0.11.0)
+ multipart-post (>= 1.2, < 3)
+ ffi (1.9.23)
+ foreman (0.83.0)
+ thor (~> 0.19.1)
+ globalid (0.3.7)
+ activesupport (>= 4.1.0)
+ haml (4.0.7)
tilt
- haml-rails (0.4)
- actionpack (>= 3.1, < 4.1)
- activesupport (>= 3.1, < 4.1)
- haml (>= 3.1, < 4.1)
- railties (>= 3.1, < 4.1)
- heroku (2.39.2)
- heroku-api (~> 0.3.7)
- launchy (>= 0.3.2)
- netrc (~> 0.7.7)
- rest-client (~> 1.6.1)
- rubyzip
- heroku-api (0.3.9)
- excon (~> 0.20.1)
- heroku_san (3.0.4)
- activesupport
- heroku (>= 2)
- heroku-api (>= 0.1.2)
- rake
- hike (1.2.2)
- i18n (0.6.4)
+ haml-rails (0.9.0)
+ actionpack (>= 4.0.1)
+ activesupport (>= 4.0.1)
+ haml (>= 4.0.6, < 5.0)
+ html2haml (>= 1.0.1)
+ railties (>= 4.0.1)
+ hashie (3.5.5)
+ html2haml (2.1.0)
+ erubis (~> 2.7.0)
+ haml (~> 4.0)
+ nokogiri (>= 1.6.0)
+ ruby_parser (~> 3.5)
+ i18n (0.8.1)
jbuilder (1.0.2)
activesupport (>= 3.0.0)
- jquery-rails (2.2.1)
- railties (>= 3.0, < 5.0)
+ jquery-rails (4.2.2)
+ rails-dom-testing (>= 1, < 3)
+ railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
- json (1.7.7)
- kgio (2.8.0)
- launchy (2.3.0)
- addressable (~> 2.3)
- mail (2.5.3)
- i18n (>= 0.4.0)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- mime-types (1.23)
- minitest (4.7.3)
- multi_json (1.7.2)
- neat (1.2.1)
- bourbon (>= 2.1)
- sass (>= 3.2)
- netrc (0.7.7)
- newrelic_rpm (3.6.1.87)
- pg (0.15.1)
- polyglot (0.3.3)
- rack (1.5.2)
- rack-robotz (0.0.3)
+ json (2.0.3)
+ json_spec (1.1.4)
+ multi_json (~> 1.0)
+ rspec (>= 2.0, < 4.0)
+ jwt (1.5.6)
+ kgio (2.11.0)
+ loofah (2.0.3)
+ nokogiri (>= 1.5.9)
+ mail (2.6.4)
+ mime-types (>= 1.16, < 4)
+ method_source (0.8.2)
+ mime-types (3.1)
+ mime-types-data (~> 3.2015)
+ mime-types-data (3.2016.0521)
+ mini_portile2 (2.1.0)
+ minitest (5.10.1)
+ modernizr-rails (2.7.1)
+ multi_json (1.12.1)
+ multi_xml (0.6.0)
+ multipart-post (2.0.0)
+ newrelic_rpm (3.18.1.330)
+ nio4r (1.2.1)
+ nokogiri (1.7.0.1)
+ mini_portile2 (~> 2.1.0)
+ oauth (0.5.1)
+ oauth2 (1.3.1)
+ faraday (>= 0.8, < 0.12)
+ jwt (~> 1.0)
+ multi_json (~> 1.3)
+ multi_xml (~> 0.5)
+ rack (>= 1.2, < 3)
+ omniauth (1.6.1)
+ hashie (>= 3.4.6, < 3.6.0)
+ rack (>= 1.6.2, < 3)
+ omniauth-github (1.2.3)
+ omniauth (~> 1.5)
+ omniauth-oauth2 (>= 1.4.0, < 2.0)
+ omniauth-oauth (1.1.0)
+ oauth
+ omniauth (~> 1.0)
+ omniauth-oauth2 (1.4.0)
+ oauth2 (~> 1.0)
+ omniauth (~> 1.2)
+ omniauth-twitter (1.4.0)
+ omniauth-oauth (~> 1.1)
+ rack
+ orm_adapter (0.5.0)
+ pg (0.20.0)
+ public_suffix (2.0.5)
+ rack (2.0.1)
+ rack-robotz (0.0.4)
rack
- rack-test (0.6.2)
+ rack-test (0.6.3)
rack (>= 1.0)
- rails (4.0.0.beta1)
- actionmailer (= 4.0.0.beta1)
- actionpack (= 4.0.0.beta1)
- activerecord (= 4.0.0.beta1)
- activesupport (= 4.0.0.beta1)
+ rails (5.0.1)
+ actioncable (= 5.0.1)
+ actionmailer (= 5.0.1)
+ actionpack (= 5.0.1)
+ actionview (= 5.0.1)
+ activejob (= 5.0.1)
+ activemodel (= 5.0.1)
+ activerecord (= 5.0.1)
+ activesupport (= 5.0.1)
bundler (>= 1.3.0, < 2.0)
- railties (= 4.0.0.beta1)
- sprockets-rails (~> 2.0.0.rc3)
- railties (4.0.0.beta1)
- actionpack (= 4.0.0.beta1)
- activesupport (= 4.0.0.beta1)
+ railties (= 5.0.1)
+ sprockets-rails (>= 2.0.0)
+ rails-controller-testing (1.0.1)
+ actionpack (~> 5.x)
+ actionview (~> 5.x)
+ activesupport (~> 5.x)
+ rails-dom-testing (2.0.2)
+ activesupport (>= 4.2.0, < 6.0)
+ nokogiri (~> 1.6)
+ rails-html-sanitizer (1.0.3)
+ loofah (~> 2.0)
+ rails_html_helpers (0.1.1)
+ railties (>= 3.2)
+ railties (5.0.1)
+ actionpack (= 5.0.1)
+ activesupport (= 5.0.1)
+ method_source
rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (>= 0.17.0, < 2.0)
- raindrops (0.11.0)
- rake (10.0.4)
- rdoc (3.12.2)
- json (~> 1.4)
- rest-client (1.6.7)
- mime-types (>= 1.16)
- rubyzip (0.9.9)
- sass (3.2.8)
- sass-rails (4.0.0.rc1)
- railties (>= 4.0.0.beta, < 5.0)
- sass (>= 3.1.10)
- sprockets-rails (~> 2.0.0.rc0)
- tilt (~> 1.3)
- settingslogic (2.0.9)
- simplecov (0.7.1)
- multi_json (~> 1.0)
- simplecov-html (~> 0.7.1)
- simplecov-html (0.7.1)
- sprockets (2.9.3)
- hike (~> 1.2)
- multi_json (~> 1.0)
- rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
- sprockets-rails (2.0.0.rc4)
+ thor (>= 0.18.1, < 2.0)
+ raindrops (0.17.0)
+ rake (12.0.0)
+ rb-fsevent (0.10.3)
+ rb-inotify (0.9.10)
+ ffi (>= 0.5.0, < 2)
+ redcarpet (3.4.0)
+ request_store (1.3.2)
+ responders (2.3.0)
+ railties (>= 4.2.0, < 5.1)
+ rspec (3.5.0)
+ rspec-core (~> 3.5.0)
+ rspec-expectations (~> 3.5.0)
+ rspec-mocks (~> 3.5.0)
+ rspec-activemodel-mocks (1.0.3)
+ activemodel (>= 3.0)
+ activesupport (>= 3.0)
+ rspec-mocks (>= 2.99, < 4.0)
+ rspec-core (3.5.4)
+ rspec-support (~> 3.5.0)
+ rspec-expectations (3.5.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.5.0)
+ rspec-its (1.2.0)
+ rspec-core (>= 3.0.0)
+ rspec-expectations (>= 3.0.0)
+ rspec-mocks (3.5.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.5.0)
+ rspec-rails (3.5.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
- sprockets (~> 2.8)
- thor (0.18.1)
- thread_safe (0.1.0)
- atomic
- tilt (1.3.7)
- treetop (1.4.12)
- polyglot
- polyglot (>= 0.3.1)
- turbolinks (1.1.1)
- coffee-rails
- turn (0.9.6)
- ansi
- tzinfo (0.3.37)
- uglifier (2.0.1)
- execjs (>= 0.3.0)
- multi_json (~> 1.0, >= 1.0.2)
- unicorn (4.6.2)
+ railties (>= 3.0)
+ rspec-core (~> 3.5.0)
+ rspec-expectations (~> 3.5.0)
+ rspec-mocks (~> 3.5.0)
+ rspec-support (~> 3.5.0)
+ rspec-support (3.5.0)
+ ruby_parser (3.8.4)
+ sexp_processor (~> 4.1)
+ sass (3.5.6)
+ sass-listen (~> 4.0.0)
+ sass-listen (4.0.0)
+ rb-fsevent (~> 0.9, >= 0.9.4)
+ rb-inotify (~> 0.9, >= 0.9.7)
+ sass-rails (5.0.6)
+ railties (>= 4.0.0, < 6)
+ sass (~> 3.1)
+ sprockets (>= 2.8, < 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+ tilt (>= 1.1, < 3)
+ settingslogic (2.0.9)
+ sexp_processor (4.8.0)
+ simple_form (3.4.0)
+ actionpack (> 4, < 5.1)
+ activemodel (> 4, < 5.1)
+ simplecov (0.13.0)
+ docile (~> 1.1.0)
+ json (>= 1.8, < 3)
+ simplecov-html (~> 0.10.0)
+ simplecov-html (0.10.0)
+ sprockets (3.7.1)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.2.0)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
+ thor (0.19.4)
+ thread_safe (0.3.6)
+ tilt (2.0.6)
+ turbolinks (5.0.1)
+ turbolinks-source (~> 5)
+ turbolinks-source (5.0.0)
+ tzinfo (1.2.2)
+ thread_safe (~> 0.1)
+ uglifier (3.1.7)
+ execjs (>= 0.3.0, < 3)
+ unicorn (5.2.0)
kgio (~> 2.6)
- rack
raindrops (~> 0.7)
+ warden (1.2.7)
+ rack (>= 1.0)
+ websocket-driver (0.6.5)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.2)
+ xpath (2.0.0)
+ nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
+ accept_values_for
+ activemodel-serializers-xml
better_errors
binding_of_caller
bourbon
- coffee-rails (~> 4.0.0.beta1)
- debugger (~> 1.5)
- exception_notification!
+ cancan
+ capybara (~> 2.1)
+ coffee-rails (~> 4.2.1)
+ devise (~> 4.2.0)
+ dotenv-rails
+ draper (~> 3.0.0.pre1)
+ exception_notification (~> 4.0.1)
+ factory_girl_rails (~> 4.2)
foreman
haml-rails
- heroku_san (~> 3.0.2)
jbuilder (~> 1.0.1)
jquery-rails
- neat
+ json_spec
+ modernizr-rails
newrelic_rpm
+ omniauth (~> 1.6.1)
+ omniauth-github
+ omniauth-twitter
pg
rack-robotz (~> 0.0.3)
- rails (= 4.0.0.beta1)
- sass-rails (~> 4.0.0.beta1)
+ rails (= 5.0.1)
+ rails-controller-testing
+ rails_html_helpers
+ redcarpet
+ rspec-activemodel-mocks
+ rspec-its
+ rspec-rails (~> 3.3)
+ sass-rails (~> 5.0.6)
settingslogic
+ simple_form (~> 3.4.0)
simplecov
+ sprockets-rails (~> 3.2.0)
turbolinks
- turn
uglifier (>= 1.0.3)
unicorn
+
+BUNDLED WITH
+ 1.16.1
diff --git a/README.md b/README.md
index c220f221..77f8066f 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,79 @@
-eurucamp-activities-2013
-========================
\ No newline at end of file
+# eurucamp Activities [](COPYRIGHT) [](https://travis-ci.org/isleofruby/isleofruby-activities)
+
+The Activities app is a small application to allow attendees to organize and plan small event in and around a conference. Users create events or sign up to created ones. Signup works through GitHub or Twitter.
+
+The app is mobile friendly and easy to run on a free Heroku account.
+
+## Donationware
+
+The app was created by members on the Ruby Berlin e.V. on their free time as a community effort initially for the eurucamp conference. Ruby Berlin is the body behind RailsGirls Berlin and Hamburg, eurucamp and JRubyConf.eu.
+
+If you end up using the app, please get in [contact](mailto:info@isleofruby.org) so that we know. Also, spread the word about our [projects](http://rubyberlin.org). Also, consider [donating](https://www.betterplace.org/en/organisations/ruby-berlin/), especially, if you run a commercial conference. We are a registered non-profit, donations are tax deducible. Betterplace handles all paperwork - if in doubt, send us a mail.
+
+If you cannot or don't want to donate - use it, it's free.
+
+## Logo
+
+Don't use the Isle of Ruby logo for your instance to avoid confusion.
+
+## Examples
+
+Screenshot: 
+
+## Running the app on Heroku
+
+To deploy the app, you need the following:
+
+* Clone this repository: `https://github.com/isleofruby/isleofruby-activities/`
+
+* An account and a created application at Heroku.
+* A registered Twitter application. Go [here](https://apps.twitter.com/).
+* A registered GitHub application. Go [here](https://github.com/settings/applications).
+
+Deploying is as easy as:
+
+* Add their keys to your Heroku app as described [here](https://devcenter.heroku.com/articles/config-vars) using the env variables described below.
+* Push the repository to Heroku: `git push git@heroku.com:.git`
+
+### **ENV** variables used:
+
+* `GITHUB_KEY`: Your GitHub application key.
+* `GITHUB_SECRET`: Your GitHub application secret.
+* `TWITTER_KEY`: Your Twitter application key.
+* `TWITTER_SECRET`: Your Twitter application secret.
+
+## Development
+
+An installed postgresql instance and a compiler is needed.
+
+### Basic setup
+
+* `echo 'activities.dev localhost' >> /etc/hosts`
+* `cp .env.sample .env`
+* `cp config/database.yml.sample config/database.yml`
+* update config files: `config/application.yml`, `.env` (see ENV variables listed above)
+* `bundle exec rake db:create`
+* `bundle exec rake db:migrate`
+* `bundle exec foreman start`
+* `tail -f log/development.log`
+* `open http://activities.dev:3000`
+* run the specs: `bundle exec rake`
+
+### Customization
+
+Customization is currently work in process, so the way to go is to fork the application.
+
+* Fork it
+* edit `config/application.yml`
+* edit `app/assets/stylesheets/_settings.sass`
+
+## Authors
+
+This app was created by:
+
+* [Florian Plank](https://twitter.com/polarblau)
+* [Piotr Gęga](https://twitter.com/piotrgega)
+
+## License
+
+GNU-AGPL-3.0, see COPYRIGHT for details.
diff --git a/Rakefile b/Rakefile
index 1b103524..32df3527 100644
--- a/Rakefile
+++ b/Rakefile
@@ -4,9 +4,3 @@
require File.expand_path('../config/application', __FILE__)
Activities::Application.load_tasks
-
-begin
- require 'heroku_san/tasks'
-rescue LoadError
- STDERR.puts "Run `rake gems:install` to install heroku_san"
-end
\ No newline at end of file
diff --git a/app/assets/images/activities/activities.svg b/app/assets/images/activities/activities.svg
new file mode 100644
index 00000000..f559d4da
--- /dev/null
+++ b/app/assets/images/activities/activities.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/assets/images/activities/create.svg b/app/assets/images/activities/create.svg
new file mode 100644
index 00000000..b11ff7bd
--- /dev/null
+++ b/app/assets/images/activities/create.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/assets/images/activities/edit.svg b/app/assets/images/activities/edit.svg
new file mode 100644
index 00000000..65f805a3
--- /dev/null
+++ b/app/assets/images/activities/edit.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/assets/images/activities/meeting_points.svg b/app/assets/images/activities/meeting_points.svg
new file mode 100644
index 00000000..e7810b68
--- /dev/null
+++ b/app/assets/images/activities/meeting_points.svg
@@ -0,0 +1,274 @@
+
+
\ No newline at end of file
diff --git a/app/assets/images/activities/register.svg b/app/assets/images/activities/register.svg
new file mode 100644
index 00000000..977ffdbb
--- /dev/null
+++ b/app/assets/images/activities/register.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/assets/images/activities/schedule.svg b/app/assets/images/activities/schedule.svg
new file mode 100644
index 00000000..e3db7879
--- /dev/null
+++ b/app/assets/images/activities/schedule.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/assets/images/activities/sign in.svg b/app/assets/images/activities/sign in.svg
new file mode 100644
index 00000000..f068f193
--- /dev/null
+++ b/app/assets/images/activities/sign in.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/assets/images/hero/IoR_illustration.svg b/app/assets/images/hero/IoR_illustration.svg
new file mode 100644
index 00000000..6a4ef1dc
--- /dev/null
+++ b/app/assets/images/hero/IoR_illustration.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/assets/images/hero/IoR_text.svg b/app/assets/images/hero/IoR_text.svg
new file mode 100644
index 00000000..21332d9a
--- /dev/null
+++ b/app/assets/images/hero/IoR_text.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/assets/images/layout/bg.png b/app/assets/images/layout/bg.png
new file mode 100644
index 00000000..4ac33ebf
Binary files /dev/null and b/app/assets/images/layout/bg.png differ
diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png
deleted file mode 100644
index d5edc04e..00000000
Binary files a/app/assets/images/rails.png and /dev/null differ
diff --git a/app/assets/images/shared/IoR_illustration.svg b/app/assets/images/shared/IoR_illustration.svg
new file mode 100644
index 00000000..6a4ef1dc
--- /dev/null
+++ b/app/assets/images/shared/IoR_illustration.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/assets/images/shared/activity_placeholder.jpg b/app/assets/images/shared/activity_placeholder.jpg
new file mode 100644
index 00000000..928f087e
Binary files /dev/null and b/app/assets/images/shared/activity_placeholder.jpg differ
diff --git a/app/assets/images/shared/buttons_big.png b/app/assets/images/shared/buttons_big.png
new file mode 100644
index 00000000..010dd028
Binary files /dev/null and b/app/assets/images/shared/buttons_big.png differ
diff --git a/app/assets/images/shared/buttons_big@2x.png b/app/assets/images/shared/buttons_big@2x.png
new file mode 100644
index 00000000..ff8f4885
Binary files /dev/null and b/app/assets/images/shared/buttons_big@2x.png differ
diff --git a/app/assets/images/shared/buttons_small.png b/app/assets/images/shared/buttons_small.png
new file mode 100644
index 00000000..4eb1e3f4
Binary files /dev/null and b/app/assets/images/shared/buttons_small.png differ
diff --git a/app/assets/images/shared/buttons_small@2x.png b/app/assets/images/shared/buttons_small@2x.png
new file mode 100644
index 00000000..c57a0be6
Binary files /dev/null and b/app/assets/images/shared/buttons_small@2x.png differ
diff --git a/app/assets/images/shared/checking.gif b/app/assets/images/shared/checking.gif
new file mode 100644
index 00000000..b041a64c
Binary files /dev/null and b/app/assets/images/shared/checking.gif differ
diff --git a/app/assets/images/shared/markdown.png b/app/assets/images/shared/markdown.png
new file mode 100644
index 00000000..c8a2a3f7
Binary files /dev/null and b/app/assets/images/shared/markdown.png differ
diff --git a/app/assets/images/shared/search.png b/app/assets/images/shared/search.png
new file mode 100644
index 00000000..117f2cc7
Binary files /dev/null and b/app/assets/images/shared/search.png differ
diff --git a/app/assets/images/user/connected.png b/app/assets/images/user/connected.png
new file mode 100644
index 00000000..3c6af81d
Binary files /dev/null and b/app/assets/images/user/connected.png differ
diff --git a/app/assets/images/user/github.png b/app/assets/images/user/github.png
new file mode 100644
index 00000000..261feb90
Binary files /dev/null and b/app/assets/images/user/github.png differ
diff --git a/app/assets/images/user/github@2x.png b/app/assets/images/user/github@2x.png
new file mode 100644
index 00000000..f99a701d
Binary files /dev/null and b/app/assets/images/user/github@2x.png differ
diff --git a/app/assets/images/user/twitter.png b/app/assets/images/user/twitter.png
new file mode 100644
index 00000000..537628d3
Binary files /dev/null and b/app/assets/images/user/twitter.png differ
diff --git a/app/assets/images/user/twitter@2x.png b/app/assets/images/user/twitter@2x.png
new file mode 100644
index 00000000..49472549
Binary files /dev/null and b/app/assets/images/user/twitter@2x.png differ
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 9e83eb5e..9688a314 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -12,5 +12,10 @@
//
//= require jquery
//= require jquery_ujs
-//= require turbolinks
-//= require_tree .
+//= require jquery.easing.min
+//= require jquery.progress
+//= require jquery.dotdotdot.min
+//= require pickadate/picker
+//= require pickadate/picker.date
+//= require pickadate/picker.time
+//= require initializers
diff --git a/app/assets/javascripts/initializers.coffee b/app/assets/javascripts/initializers.coffee
new file mode 100644
index 00000000..cd0148ba
--- /dev/null
+++ b/app/assets/javascripts/initializers.coffee
@@ -0,0 +1,176 @@
+ready = ->
+ $(document).ajaxError (e, xhr) ->
+ window.location.replace(App.paths.login) if xhr.status == 401
+
+ $('#activities .labels h4').dotdotdot
+ height: 55
+
+ # hide validation errors on focus
+ $('input.validation-error').on 'focus', ->
+ $(@).next('span.validation-error-message').fadeOut()
+
+ # show how "full" an activity is
+ $('#activities .progress').progress()
+ $('#activity .progress').progress(strokeWidth: 12)
+
+ $('.date-capture').pickadate
+ min: new Date(App.event.startTime)
+ max: new Date(App.event.endTime)
+ format: 'ddd, d.m.'
+ formatSubmit: 'dd-mm-yyyy'
+ today: ''
+ clear: ''
+ onSet: (e)->
+ target = @$node.data 'target'
+ {year, month, date} = @get 'select'
+ $("#activity_#{target}_1i").val(year)
+ $("#activity_#{target}_2i").val(month + 1)
+ $("#activity_#{target}_3i").val(date)
+ $('#activity_anytime').attr('checked', false)
+ onClose: ->
+ # TODO: Extract?
+ otherSelector = @$node.data('update')
+ other = $(otherSelector).pickadate('picker')
+ {year, month, date, pick} = @get 'select'
+ otherPick = other.get('select').pick
+
+ if otherSelector.match /end-time/
+ other.set 'min', [year, month, date]
+ other.set 'select', [year, month, date] if otherPick < pick
+ else
+ other.set 'max', [year, month, date]
+ other.set 'select', [year, month, date] if otherPick > pick
+
+ if onSameDay() then setTimePickerLimits() else removeTimePickerLimits()
+
+ $('.time-capture').pickatime
+ format: 'HH:i'
+ formatSubmit: 'HH:i'
+ clear: ''
+ onSet: (e)->
+ target = @$node.data 'target'
+ if e.select?
+ [hours, minutes] = [parseInt((e.select / 60), 10), e.select % 60]
+
+ $("#activity_#{target}_4i").val(if hours < 10 then "0#{hours}" else hours)
+ $("#activity_#{target}_5i").val(if minutes < 10 then "0#{minutes}" else minutes)
+ $('#activity_anytime').attr('checked', false)
+ onClose: ->
+ if onSameDay() then setTimePickerLimits() else removeTimePickerLimits()
+
+ # run through time pickers and
+ # adjust the corresponding picker's limits
+ setTimePickerLimits = ->
+ $('.time-capture').each ->
+ picker = $(@).pickatime('picker')
+ otherSelector = picker.$node.data('update')
+ other = $(otherSelector).pickatime('picker')
+ {hour, mins} = picker.get 'select'
+
+ if otherSelector.match /end-time/
+ other.set 'min', [hour, mins]
+ else
+ other.set 'max', [hour, mins]
+
+ # remove min and max values from time pickers
+ removeTimePickerLimits = (picker)->
+ $('.time-capture').each ->
+ $(@).pickatime('picker').set 'min': null, 'max': null
+
+ onSameDay = ->
+ $.unique(
+ $.map($('.date-capture'), (el)->
+ $(el).pickadate('picker').get('select').pick
+ )
+ ).length == 1
+
+ # filters
+ $filters = $('form.filters label:not(.search)')
+ $search = $('form.filters label.search input')
+ $activities = $('#activities li')
+ $days = $('.activity-day')
+
+ $filters.attr('unselectable', 'on')
+ .css('user-select', 'none')
+ .on('selectstart', false)
+
+ filterActivities = ->
+ $activities.show()
+ $days.show()
+ # the filter tabs
+ values = $filters.filter('.selected')
+ .find('input[type=radio]')
+ .map(-> $(@).val()).get()
+ unless 'all' in values
+ $activities.not(".#{values.join(',.')}").hide()
+ # use search input to filter further
+ if query = $search.val()
+ $activities
+ .filter(':visible')
+ .filter(-> !(new RegExp(query, 'i')).test $(@).find('a.details').attr('title'))
+ .hide()
+ hideEmptyDays()
+
+ hideEmptyDays = ->
+ $days
+ .filter(-> $(@).find('li:visible').length == 0)
+ .hide()
+
+ $filters.on 'click', (e)->
+ e.preventDefault()
+ $filter = $(@)
+ if !e.shiftKey || (e.shiftKey && $filter.find('input').val() == 'all')
+ $filters.removeClass 'selected'
+ $filter.addClass('selected')
+ filterActivities()
+
+ # search
+ # TODO: debounce
+ $search.on 'keyup', filterActivities
+
+ $search.next('a.clear').on 'click', (e)->
+ e.preventDefault()
+ $search.val('').trigger 'keyup'
+
+ # form
+ checkImageURL = (url, success, error) ->
+ try
+ img = new Image()
+ img.onload = -> success(url)
+ img.onerror = -> error(url)
+ img.src = url
+ catch error
+
+ # form
+ $('#new-activity #activity_image_url')
+ .on 'keyup focus blur', ->
+ $input = $(@)
+ $preview = $input.next('.preview').addClass('checking')
+
+ error = ->
+ $input.addClass 'validation-error' if $input.val().length
+ $preview
+ .css('backgroundImage', '')
+ .removeClass 'checking'
+ success = (url) ->
+ $input.removeClass 'validation-error'
+ $preview
+ .css('backgroundImage', "url(#{url})")
+ .removeClass 'checking'
+ checkImageURL @value, success, error
+
+ .trigger('keyup')
+
+
+ hideNotification = ->
+ $('#notifications').addClass 'hide'
+
+ $('#notifications').on 'click', hideNotification
+ setTimeout hideNotification, 3000
+
+ toggleMap = ->
+ $('#meeting-point-map').toggle()
+ $('#show-map').on 'click', toggleMap
+
+$(document).ready(ready)
+$(document).on('page:load', ready)
diff --git a/app/assets/stylesheets/_base.scss b/app/assets/stylesheets/_base.scss
new file mode 100644
index 00000000..39adc009
--- /dev/null
+++ b/app/assets/stylesheets/_base.scss
@@ -0,0 +1,75 @@
+body {
+ background-image: image-url('layout/bg.png');
+ background-size: 20vh;
+}
+
+
+.page-section {
+ &__wrapper {
+ width: 100vw;
+ min-height: calc(100vh - 50px);
+ display: flex;
+ flex-direction: column;
+ flex-wrap: wrap;
+ align-content: center;
+ align-items: stretch;
+ @media (min-width: $mobile-tablet-landscape){
+ flex-direction: row;
+ justify-content: space-between;
+ }
+ @media (min-width: $desktop-medium) {
+ max-width: $desktop-medium;
+ margin: 0 auto;
+ }
+ }
+
+ &__image {
+ text-align: center;
+ padding: 2rem 0;
+ @media (min-width: $mobile-tablet-landscape){
+ display: flex;
+ align-content: center;
+ padding: 0;
+ flex-wrap: wrap;
+ justify-content: space-between;
+ width: 10vw;
+ align-items: stretch;
+ }
+ .page-section__image--horizontal {
+ max-width: 90%;
+ @media (min-width: $mobile-tablet-portrait) {
+ max-width: 60%;
+ }
+ @media (min-width: $mobile-tablet-landscape){
+ display: none;
+ }
+ }
+ .page-section__image--vertical {
+ width: 70%;
+ display: none;
+ align-self: flex-start;
+ padding: 8rem 0 4rem; // same as inner
+ @media (min-width: $mobile-tablet-landscape){
+ display: block;
+ }
+ }
+ }
+
+ &__inner {
+ width: 100vw;
+ padding: 2rem;
+ @media (min-width: $mobile-tablet-landscape){
+ width: 90vw;
+ max-width: 1000px;
+ padding: 8rem 2rem 5rem;
+ }
+ }
+}
+
+.page-section--sub-page {
+ .page-section__image {
+ @media (max-width: $mobile-tablet-landscape){
+ margin-top: 140px; //page-header-mobile-sky height
+ }
+ }
+}
diff --git a/.env b/app/assets/stylesheets/_fonts.scss
similarity index 100%
rename from .env
rename to app/assets/stylesheets/_fonts.scss
diff --git a/app/assets/stylesheets/_settings.sass b/app/assets/stylesheets/_settings.sass
deleted file mode 100644
index 1d4c9a17..00000000
--- a/app/assets/stylesheets/_settings.sass
+++ /dev/null
@@ -1,33 +0,0 @@
-@import "neat-helpers"
-
-// DEV
-$visual-grid: false
-
-// grid set-up
-$column: 225px
-$gutter: 0px
-$padding: 20px
-$grid-columns: 8
-$max-width: em(900)
-
-// breakpoints
-$low-end: max-width 160px 1
-$mid-range: max-width 240px 1
-$smartphone-portrait: max-width 320px 2
-$smartphone-landscape: max-width 480px 2
-$tablet-lite: max-width 640px 2
-$tablet-lite-plus: max-width 750px 4
-$tablet-portrait: max-width 768px 4
-$tablet-portrait-plus: max-width 860px 4
-
-// colors
-$red: #e55924
-$blue: #0ca9c4
-$gray: #5b5e61
-
-$green: #15d701
-
-$black: #222222
-$white: #ffffff
-$light-gray: #e2e2e2
-$extra-light-gray: #f7f7f7
diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss
new file mode 100644
index 00000000..c83c1192
--- /dev/null
+++ b/app/assets/stylesheets/_settings.scss
@@ -0,0 +1,7 @@
+// Colours
+$light-blue: #CEEBFB;
+$mid-blue: #A3D6F5;
+$dark-blue: #66A7C5;
+$red: #EE3233;
+$light-grey: #F0ECEB;
+$dark-grey: #6C7476;
diff --git a/app/assets/stylesheets/_utils.scss b/app/assets/stylesheets/_utils.scss
new file mode 100644
index 00000000..58b6617b
--- /dev/null
+++ b/app/assets/stylesheets/_utils.scss
@@ -0,0 +1,5 @@
+@mixin unlisted {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss
index 87dcf3cb..3e5212e4 100644
--- a/app/assets/stylesheets/application.css.scss
+++ b/app/assets/stylesheets/application.css.scss
@@ -1,4 +1,24 @@
-@import "settings";
+@import url("https://use.typekit.net/saw4kew.css");
+@import "vendor/normalize.css";
+@import "vendor/animate-custom";
@import "bourbon";
-@import "neat";
+
+@import "base/base";
+
+@import "settings";
+
+@import "fonts";
+@import "utils";
+@import "base";
+
+@import "pickadate/default";
+@import "pickadate/default.date";
+@import "pickadate/default.time";
+
+@import "partials/hero";
+@import "partials/footer";
+
+@import "partials/home";
+@import "partials/activities";
+@import "partials/schedule";
diff --git a/app/assets/stylesheets/base/_base.scss b/app/assets/stylesheets/base/_base.scss
new file mode 100644
index 00000000..d1eccee8
--- /dev/null
+++ b/app/assets/stylesheets/base/_base.scss
@@ -0,0 +1,14 @@
+// Bitters 1.5.0
+// http://bitters.bourbon.io
+// Copyright 2013-2015 thoughtbot, inc.
+// MIT License
+
+@import "variables";
+
+@import "buttons";
+@import "forms";
+@import "layout";
+@import "lists";
+@import "media";
+@import "tables";
+@import "typography";
diff --git a/app/assets/stylesheets/base/_buttons.scss b/app/assets/stylesheets/base/_buttons.scss
new file mode 100644
index 00000000..dc0ebb95
--- /dev/null
+++ b/app/assets/stylesheets/base/_buttons.scss
@@ -0,0 +1,43 @@
+#{$all-buttons}, .button {
+ appearance: none;
+ // background-color: $action-color;
+ border: 5px solid $action-color;
+ // border-radius: $base-border-radius;
+ color: $action-color;
+ cursor: pointer;
+ display: inline-block;
+ font-family: $base-font-family;
+ font-size: 1em;
+ -webkit-font-smoothing: antialiased;
+ font-weight: 600;
+ line-height: 1;
+ padding: $small-spacing $base-spacing;
+ text-align: center;
+ text-decoration: none;
+ transition: background-color $base-duration $base-timing;
+ user-select: none;
+ vertical-align: middle;
+ white-space: nowrap;
+
+ &:hover,
+ &:focus {
+ background-color: shade($action-color, 20%);
+ color: white;
+ opacity: .8;
+ }
+
+ &:disabled {
+ cursor: not-allowed;
+ opacity: 0.5;
+
+ &:hover {
+ background-color: $action-color;
+ }
+ }
+}
+
+@media (max-width: 500px) {
+ #{$all-buttons}, .button {
+ font-size: .8em;
+ }
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/base/_forms.scss b/app/assets/stylesheets/base/_forms.scss
new file mode 100644
index 00000000..a50f6a65
--- /dev/null
+++ b/app/assets/stylesheets/base/_forms.scss
@@ -0,0 +1,82 @@
+fieldset {
+ background-color: transparent;
+ border: 0;
+ margin: 0;
+ padding: 0;
+}
+
+legend {
+ font-weight: 600;
+ margin-bottom: $small-spacing / 2;
+ padding: 0;
+}
+
+label {
+ display: block;
+ font-weight: 600;
+ margin-bottom: $small-spacing / 2;
+}
+
+input,
+select,
+textarea {
+ display: block;
+ font-family: $base-font-family;
+ font-size: $base-font-size;
+}
+
+#{$all-text-inputs} {
+ appearance: none;
+ background-color: $base-background-color;
+ border: $base-border;
+ border-radius: $base-border-radius;
+ box-shadow: $form-box-shadow;
+ box-sizing: border-box;
+ margin-bottom: $small-spacing;
+ padding: $base-spacing / 3;
+ transition: border-color $base-duration $base-timing;
+ width: 100%;
+
+ &:hover {
+ border-color: shade($base-border-color, 20%);
+ }
+
+ &:focus {
+ border-color: $action-color;
+ box-shadow: $form-box-shadow-focus;
+ outline: none;
+ }
+
+ &:disabled {
+ background-color: shade($base-background-color, 5%);
+ cursor: not-allowed;
+
+ &:hover {
+ border: $base-border;
+ }
+ }
+
+ &::placeholder {
+ color: tint($base-font-color, 40%);
+ }
+}
+
+textarea {
+ resize: vertical;
+}
+
+[type="checkbox"],
+[type="radio"] {
+ display: inline;
+ margin-right: $small-spacing / 2;
+}
+
+[type="file"] {
+ margin-bottom: $small-spacing;
+ width: 100%;
+}
+
+select {
+ margin-bottom: $small-spacing;
+ width: 100%;
+}
diff --git a/app/assets/stylesheets/base/_layout.scss b/app/assets/stylesheets/base/_layout.scss
new file mode 100644
index 00000000..723e80eb
--- /dev/null
+++ b/app/assets/stylesheets/base/_layout.scss
@@ -0,0 +1,50 @@
+html {
+ box-sizing: border-box;
+}
+
+*,
+*::before,
+*::after {
+ box-sizing: inherit;
+}
+
+html,
+body {
+ height: 100%;
+}
+
+.ribbon {
+ background-color: #EF5255;
+ overflow: hidden;
+ white-space: nowrap;
+ /* top left corner */
+ position: fixed;
+ left: -60px;
+ top: 22px;
+ width: 200px;
+ /* 45 deg ccw rotation */
+ -webkit-transform: rotate(-45deg);
+ -moz-transform: rotate(-45deg);
+ -ms-transform: rotate(-45deg);
+ -o-transform: rotate(-45deg);
+ transform: rotate(-45deg);
+ /* shadow */
+ -webkit-box-shadow: 0 0 10px #888;
+ -moz-box-shadow: 0 0 10px #888;
+ box-shadow: 0 0 10px #888;
+ a {
+ border: 1px solid #faa;
+ color: #fff;
+ display: block;
+ font: bold 81.25% 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ margin: 1px 0;
+ padding: 10px 50px;
+ text-align: center;
+ text-decoration: none;
+ /* shadow */
+ text-shadow: 0 0 5px #444;
+ &:hover {
+ color: #E0F3FA;
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/base/_lists.scss b/app/assets/stylesheets/base/_lists.scss
new file mode 100644
index 00000000..06a7c0a8
--- /dev/null
+++ b/app/assets/stylesheets/base/_lists.scss
@@ -0,0 +1,19 @@
+ul,
+ol {
+ list-style-type: none;
+ margin: 0;
+ padding: 0;
+}
+
+dl {
+ margin: 0;
+}
+
+dt {
+ font-weight: 600;
+ margin: 0;
+}
+
+dd {
+ margin: 0;
+}
diff --git a/app/assets/stylesheets/base/_media.scss b/app/assets/stylesheets/base/_media.scss
new file mode 100644
index 00000000..dfa22eae
--- /dev/null
+++ b/app/assets/stylesheets/base/_media.scss
@@ -0,0 +1,9 @@
+figure {
+ margin: 0;
+}
+
+img,
+picture {
+ margin: 0;
+ max-width: 100%;
+}
diff --git a/app/assets/stylesheets/base/_tables.scss b/app/assets/stylesheets/base/_tables.scss
new file mode 100644
index 00000000..b3816653
--- /dev/null
+++ b/app/assets/stylesheets/base/_tables.scss
@@ -0,0 +1,45 @@
+table {
+ border-collapse: collapse;
+ margin: $small-spacing 0;
+ table-layout: fixed;
+ width: 100%;
+ font-size: 1.1rem;
+}
+
+th {
+ border-bottom: $base-border;
+ font-weight: 600;
+ padding: $small-spacing 0;
+ text-align: left;
+ &.-center {
+ text-align: center;
+ }
+}
+
+td {
+ border-bottom: $base-border;
+ padding: $small-spacing 0;
+ text-align: center;
+ &.-left {
+ text-align: left;
+ }
+ &.-crossed_out {
+ text-decoration: line-through;
+ color: $medium-gray;
+ }
+ &.-grayed_out {
+ color: $medium-gray;
+ }
+}
+
+tr,
+td,
+th {
+ vertical-align: middle;
+}
+
+@media (max-width: 700px) {
+ table {
+ font-size: .6rem;
+ }
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/base/_typography.scss b/app/assets/stylesheets/base/_typography.scss
new file mode 100644
index 00000000..2dff5d3c
--- /dev/null
+++ b/app/assets/stylesheets/base/_typography.scss
@@ -0,0 +1,51 @@
+body {
+ color: $base-font-color;
+ font-family: $base-font-family;
+ font-size: $base-font-size;
+ line-height: $base-line-height;
+ letter-spacing: .1px;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: $heading-font-family;
+ font-size: modular-scale(1);
+ line-height: $heading-line-height;
+ margin: 0 0 $small-spacing;
+}
+
+p, ul {
+ margin: 0 0 $small-spacing;
+}
+
+a {
+ color: $action-color;
+ text-decoration: none;
+ transition: color $base-duration $base-timing;
+
+ &:active,
+ &:focus,
+ &:hover {
+ color: shade($action-color, 25%);
+ }
+}
+
+hr {
+ border-bottom: $base-border;
+ border-left: 0;
+ border-right: 0;
+ border-top: 0;
+ margin: $base-spacing 0;
+}
+
+.small {
+ font-size: 80%;
+}
+
+ul {
+ list-style: square;
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/base/_variables.scss b/app/assets/stylesheets/base/_variables.scss
new file mode 100644
index 00000000..1e02ecdf
--- /dev/null
+++ b/app/assets/stylesheets/base/_variables.scss
@@ -0,0 +1,56 @@
+// Breakpoints
+$medium-screen: 600px;
+$large-screen: 900px;
+
+// Typography
+$base-font-family: "abril-text", serif;
+$heading-font-family: $base-font-family;
+
+// Font Sizes
+$base-font-size: 1.4em;
+
+// Line height
+$base-line-height: 1.5;
+$heading-line-height: 1.2;
+
+// Other Sizes
+$base-border-radius: 3px;
+$base-spacing: $base-line-height * 1em;
+$small-spacing: $base-spacing / 2;
+$base-z-index: 0;
+
+// Colors
+$blue: #0C8DB7;
+$dark-gray: #444;
+$medium-gray: #999;
+$light-gray: #ddd;
+
+// Font Colors
+$base-font-color: $dark-gray;
+$action-color: $blue;
+
+// Border
+$base-border-color: $light-gray;
+$base-border: 1px solid $base-border-color;
+
+// Background Colors
+$base-background-color: #fff;
+$secondary-background-color: tint($base-border-color, 75%);
+
+// Forms
+$form-box-shadow: inset 0 1px 3px rgba(#000, 0.06);
+$form-box-shadow-focus: $form-box-shadow, 0 0 5px adjust-color($action-color, $lightness: -5%, $alpha: -0.3);
+
+// Animations
+$base-duration: 150ms;
+$base-timing: ease;
+
+// Media Queries
+
+$mobile-phone: 475px;
+$mobile-tablet-portrait: 768px;
+$mobile-tablet-landscape: 1024px;
+$desktop-medium: 1280px;
+
+$extra-light-gray: #eee;
+$light-gray: #ccc;
diff --git a/app/assets/stylesheets/partials/_activities.scss b/app/assets/stylesheets/partials/_activities.scss
new file mode 100644
index 00000000..01051eaf
--- /dev/null
+++ b/app/assets/stylesheets/partials/_activities.scss
@@ -0,0 +1,103 @@
+
+body.activities {
+ @import "activities/shared";
+
+ &.index {
+ @import "activities/filters";
+ @import "activities/index";
+ }
+
+ &.show {
+ @import "activities/show";
+ }
+
+ &.new,
+ &.edit,
+ &.create,
+ &.update {
+ @import "activities/form";
+ }
+}
+
+.page-section--activities {
+ background: linear-gradient(180deg, rgba(140, 208, 240, .2), rgba(140, 208, 240, .4));
+}
+
+.activity-list {
+ @include unlisted;
+ display: flex;
+ flex-direction: column;
+ flex-wrap: wrap;
+ text-align: center;
+ @media (min-width: $mobile-phone) {
+ flex-direction: row;
+ }
+
+ &__item {
+ box-sizing: border-box;
+ padding: 20px 0;
+ @media (min-width: $mobile-phone) {
+ flex-basis: 33%;
+ max-width: 33%;
+ }
+ @media (min-width: $mobile-tablet-landscape) {
+ flex-basis: 25%;
+ max-width: 25%;
+ }
+ }
+}
+
+.activity-avatar {
+ align-items: center;
+ display: flex;
+ margin-bottom: 2em;
+ @media (max-width: $mobile-phone) {
+ flex-direction: column;
+ }
+ &__caption {
+ flex: 1;
+ @media (max-width: $mobile-phone) {
+ text-align: center;
+ }
+ }
+ &__name {
+ font-size: 2.5rem;
+ margin-bottom: 0;
+ }
+ &__photo {
+ border: 2px solid #fff;
+ border-radius: 50%;
+ margin-right: 1em;
+ width: 20%;
+ @media (max-width: $mobile-phone) {
+ margin-bottom: 1em;
+ margin-right: 0;
+ width: 60%;
+ }
+ }
+ &__twitter,
+ &__company {
+ margin-bottom: 0;
+ }
+ &__company {
+ color: lighten($dark-gray, 15);
+ }
+}
+
+.activity-avatar--list {
+ margin-bottom: 0;
+ .activity-avatar__photo {
+ margin-right: 0;
+ width: 65%;
+ @media (max-width: $mobile-phone) {
+ margin-bottom: 0.5em;
+ }
+ }
+ .activity-avatar__name {
+ font-size: 1.3rem;
+ }
+}
+
+.session {
+ margin: 3em 0;
+}
diff --git a/app/assets/stylesheets/partials/_footer.scss b/app/assets/stylesheets/partials/_footer.scss
new file mode 100644
index 00000000..d0a0a53b
--- /dev/null
+++ b/app/assets/stylesheets/partials/_footer.scss
@@ -0,0 +1,96 @@
+.footer {
+ background-color: darken(rgba(79, 113, 154, .8), 40%);
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: flex-start;
+ align-content: stretch;
+ align-items: flex-start;
+ color: #999;
+ text-align: center;
+ font-size: 1rem;
+ .footer-signature, .footer-social, .footer-newsletter {
+ flex-grow: 1;
+ flex-basis: 250px;
+ padding: 2rem;
+ }
+ .footer-signature {
+ img {
+ filter: grayscale(100%);
+ max-width: 125px;
+ display: block;
+ margin: 0 auto;
+ }
+ .colophon {
+ padding-top: 1rem;
+ }
+ }
+}
+
+.footer-social {
+ &__list {
+ @include unlisted;
+ }
+
+ &__list-item {
+ display: inline;
+ }
+
+ &__list-link {
+ width: 40px;
+ height: 40px;
+ display: inline-block;
+ text-indent: -999em;
+ background: transparent url(/images/footer/social_sprite.png) no-repeat;
+
+ $x: 0px;
+ @each $item in twitter, facebook, github, instagram, medium {
+ &.-#{$item} {
+ background-position: $x 0;
+ $x: $x - 40px;
+ }
+ }
+
+ &:hover {
+ background-position-y: -40px;
+ }
+ }
+ .footer-navigation {
+ padding-top: 1rem;
+ &__list {
+ @include unlisted;
+ }
+
+ &__list-item {
+ // display: inline;
+ }
+
+ &__list-link {
+ // color: white;
+ }
+ }
+}
+
+.footer-newsletter {
+ p, input, label {
+ font-size: 1rem;
+ font-weight: 400;
+ }
+ input {
+ max-width: 250px;
+ margin: .5rem auto;
+ }
+ .button {
+ background: transparent;
+ text-transform: uppercase;
+ letter-spacing: 1px;
+ font-family: 'Adonis-web';
+ font-weight: 700;
+ &:hover,
+ &:focus {
+ background-color: shade($action-color, 20%);
+ color: white;
+ opacity: .8;
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/partials/_hero.scss b/app/assets/stylesheets/partials/_hero.scss
new file mode 100644
index 00000000..06de99df
--- /dev/null
+++ b/app/assets/stylesheets/partials/_hero.scss
@@ -0,0 +1,95 @@
+.page-header-mobile {
+ .page-header-mobile-sky {
+ position: fixed;
+ top: 0;
+ width: 100vw;
+ height: 60px;
+ background: #ACE2F7;
+ background-image: linear-gradient(to bottom, #71C4EC 0%, #ACE2F7 100%);
+ opacity: .9;
+ }
+ .page-header-mobile-logo {
+ position: fixed;
+ top: -32px;
+ left: calc(50vw - 100px); //25vw;
+ width: 200px; //50vw;
+ height: 200px; //50vw;
+ background-image: image-url('hero/IoR_illustration.svg');
+ background-repeat: no-repeat;
+ background-position: center;
+ z-index: 100;
+ }
+ .page-header-mobile-text {
+ padding-top: 150px;
+ text-align: center;
+ img {
+ width: 80%;
+ max-width: 500px;
+ }
+ }
+}
+.page-header {
+ display: none;
+}
+
+@media (min-width: 700px) and (min-height: 650px) {
+ .page-header-mobile {
+ display: none;
+ }
+ .page-header {
+ display: block;
+ min-height: 25vh;
+
+ &--hero {
+ position: fixed;
+ min-height: 90vh;
+ }
+
+ &__sky {
+ position: absolute;
+ top: 0;
+ width: 100vw;
+ height: 8vw;
+ background: #ACE2F7;
+ background-image: linear-gradient(to bottom, #71C4EC 0%, #ACE2F7 100%);
+ opacity: .9;
+
+ .page-header--hero & {
+ height: 200px; // 20vw;
+ }
+ }
+
+ &__logo {
+ position: absolute;
+ top: -0.5vw;
+ left: 40vw;
+ width: 20vw;
+ height: 20vw;
+
+ background-image: image-url('hero/IoR_illustration.svg');
+ background-repeat: no-repeat;
+ background-position: center;
+ z-index: 100;
+
+ .page-header--hero & {
+ top: -120px;
+ left: calc(50vw - 350px); //25vw;
+ width: 700px; //50vw;
+ height: 700px; //50vw;
+ }
+ }
+
+ &__logo-text {
+ display: none;
+
+ .page-header--hero & {
+ display: block;
+ }
+
+ img {
+ width: 700px;
+ margin: 550px 0; //vw 0;
+ }
+ }
+ }
+}
diff --git a/app/assets/stylesheets/partials/_home.scss b/app/assets/stylesheets/partials/_home.scss
new file mode 100644
index 00000000..258cd899
--- /dev/null
+++ b/app/assets/stylesheets/partials/_home.scss
@@ -0,0 +1,84 @@
+#home {
+ .page-section__inner {
+ display:flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: flex-start;
+ align-content: flex-end;
+ align-items: flex-end;
+ height: 50vh;
+ width: 100vw;
+ max-width: 100vw;
+ padding-bottom: 2vh;
+ }
+ .page-section__image {
+ display: none;
+ }
+}
+
+.home--intro {
+ text-align: center;
+ width: 100%;
+ z-index: 100;
+ h1, h2 {
+ margin: 0;
+ }
+ h1 {
+ font-size: .8em;
+ }
+ h1.isleofruby {
+ animation-duration: 3s;
+ animation-name: changeopacity;
+ animation-iteration-count: infinite;
+ animation-direction: alternate;
+ letter-spacing: 0px;
+ }
+ h1.iloveruby {
+ animation-duration: 3s;
+ animation-name: changeopacityreversed;
+ animation-iteration-count: infinite;
+ animation-direction: alternate;
+ margin-top: -1.35rem;
+ letter-spacing: .9px;
+ }
+ @keyframes changeopacity {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+ }
+ @keyframes changeopacityreversed {
+ from {
+ opacity: 1;
+ }
+ to {
+ opacity: 0;
+ }
+ }
+
+ h2 {
+ font-size: 1em;
+ }
+}
+
+@media (min-width: 700px) and (min-height: 650px) {
+ #home {
+ .page-section__inner {
+ height: 100vh;
+ }
+ }
+}
+
+.home--intro-tickets {
+ padding-bottom: 1rem;
+ margin: 0;
+}
+
+.home--intro-link {
+ display: block;
+ padding-top: 1rem;
+ font-size: 14px;
+ text-decoration: underline;
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/partials/_schedule.scss b/app/assets/stylesheets/partials/_schedule.scss
new file mode 100644
index 00000000..e390ea63
--- /dev/null
+++ b/app/assets/stylesheets/partials/_schedule.scss
@@ -0,0 +1,3 @@
+.page-section--schedule {
+ background-color: $light-grey;
+}
diff --git a/app/assets/stylesheets/partials/activities/_filters.scss b/app/assets/stylesheets/partials/activities/_filters.scss
new file mode 100644
index 00000000..c3e3e7ca
--- /dev/null
+++ b/app/assets/stylesheets/partials/activities/_filters.scss
@@ -0,0 +1,165 @@
+form.filters {
+ border-radius: 3px;
+ overflow: hidden;
+ padding: 0 0 2.5em 0;
+
+ label {
+ background: lighten($extra-light-gray, 5);
+ border: 0;
+ color: #808080;
+
+ //+custom-sans(medium)
+ display: block;
+ margin: 0 0 1px 0;
+ padding: 0.75em 1em;
+ text-align: left;
+ text-transform: uppercase;
+
+ transition: all 0.5s;
+
+ &.participant,
+ &.owner {
+ &:before {
+ content: "•";
+ display: inline-block;
+ font-size: 2.5em;
+ line-height: 1px;
+ margin: 0 0.25em 0.25em 0;
+
+ html.no-js & {
+ margin: 0 0.25em 0.1em 0;
+ }
+ }
+ }
+
+ &.participant:before {
+ color: #008000;
+ }
+
+ &.owner {
+ border-radius: 0 0 3px 3px;
+
+ &:before {
+ color: #ff0;
+ }
+ }
+
+ &.search {
+ background: none;
+ margin-top: 1em;
+ padding: 0;
+ width: 100%;
+
+ &:hover {
+ background: none;
+ }
+
+ input {
+ background: #fff image-url("shared/search.png") no-repeat right center;
+ border: 1px solid $light-gray;
+
+ &:focus {
+ background: none;
+ border-color: #00f;
+ }
+ }
+
+ a {
+ position: absolute;
+ right: 0;
+ top: 1em;
+ }
+ }
+
+ strong {
+ //+custom-sans(light)
+ float: right;
+ margin: 0 0 0 0.75em;
+ }
+
+ &:hover {
+ background: #00f;
+ color: #fff;
+ cursor: pointer;
+
+ transition: all 0.15s;
+ }
+
+ &.selected {
+ background: $medium-gray;
+ color: #fff;
+ }
+ }
+
+ input {
+ &[type="radio"] {
+ margin: 0 0.75em 0 0;
+ }
+ }
+
+ button {
+ background: $medium-gray;
+ border: 0;
+ border-radius: 3px;
+ color: #fff;
+ display: block;
+ margin: 1em auto;
+ padding: 0.4em 2em;
+
+ transition: all 0.15s;
+
+ &:hover {
+ background: #00f;
+
+ color: #fff;
+ transition: all 0.15s;
+ }
+ }
+
+ button, input[type="radio"] {
+ html.js & {
+ display: none;
+ }
+ }
+
+
+ @media (min-width: $mobile-tablet-landscape) {
+ border-radius: none;
+ float: left;
+ overflow: visible;
+ padding: 0 0 4.5em 0;
+
+ label {
+ display: inline-block;
+ margin: 0 1px 0 0;
+
+ strong {
+ float: none
+ }
+
+ &:first-child {
+ border-radius: 3px 0 0 3px
+ }
+
+ &.owner {
+ border-radius: 0 3px 3px 0;
+ margin: 0;
+ }
+
+ &.search {
+ left: 0;
+ margin-top: 0;
+ position: absolute;
+ top: 4em;
+ }
+ }
+
+ button {
+ display: inline-block;
+ margin: 0 0 0 0.5em;
+ padding: 0.45em 0.75em;
+ }
+
+
+ }
+}
diff --git a/app/assets/stylesheets/partials/activities/_form.scss b/app/assets/stylesheets/partials/activities/_form.scss
new file mode 100644
index 00000000..147c297d
--- /dev/null
+++ b/app/assets/stylesheets/partials/activities/_form.scss
@@ -0,0 +1,136 @@
+form#new-activity {
+ input.date-capture,
+ input.time-capture {
+ display: none;
+ }
+
+ html.js & {
+ .select {
+ display: none;
+ }
+
+ input.date-capture,
+ input.time-capture {
+ display: inline;
+ }
+ }
+
+ span {
+ &.divider {
+ text-align: center;
+ width: 10%;
+ }
+ }
+
+ fieldset {
+ &.start-time,
+ &.end-time {
+ display: inline-block;
+ position: relative;
+ width: 45%;
+
+ span.validation-error-message {
+ float: right;
+ line-height: 1.5em;
+ position: relative;
+ right: 15px;
+ top: 0;
+ }
+ }
+
+ &.end-time {
+ float: right;
+ }
+
+ &.anytime {
+ clear: both;
+
+ span {
+ // @include custom-sans(bold);
+
+ margin: 0 1em 0 15px;
+ text-transform: uppercase;
+ }
+ }
+ }
+
+ input {
+ &.date-capture {
+ width: 69%;
+ }
+
+ &.time-capture {
+ text-align: center;
+ width: 4em;
+ width: 30%;
+ }
+ }
+
+ label {
+ &.location {
+ display: inline-block;
+
+ // @include span-columns(6);
+ @media (min-width: $mobile-tablet-portrait) {
+ // @include span-columns(3);
+ }
+ }
+
+ &.limit-of-participants {
+ display: inline-block;
+ text-align: right;
+
+ // @include span-columns(6);
+
+ @media (min-width: $mobile-tablet-portrait) {
+ // @include span-columns(1);
+
+ input {
+ width: 85%;
+ }
+ }
+ }
+
+ &.image-url {
+ .preview {
+ background-position: center;
+ background-size: cover;
+ border-radius: 1.45em;
+ height: 2.9em;
+ position: absolute;
+ right: 0.5em;
+ top: 0.5em;
+ width: 2.9em;
+ z-index: 1000;
+
+ &.checking {
+ background-image: image-url("shared/checking.gif") !important;
+ background-repeat: no-repeat !important;
+ background-size: auto !important;
+ }
+ }
+ }
+ }
+
+ button {
+ font-size: 1.5em;
+ }
+
+ .meeting-point-map {
+ display: none;
+ padding: 3em 0;
+ width: 80%;
+ }
+}
+
+.delete-activity {
+ margin-top: 4em;
+
+ header {
+ margin-bottom: 0.5em;
+ }
+
+ button {
+ background-color: $red;
+ }
+}
diff --git a/app/assets/stylesheets/partials/activities/_index.scss b/app/assets/stylesheets/partials/activities/_index.scss
new file mode 100644
index 00000000..3683375d
--- /dev/null
+++ b/app/assets/stylesheets/partials/activities/_index.scss
@@ -0,0 +1,306 @@
+a#new-activity {
+ float: right;
+
+ // @extend %icon-button-add;
+}
+
+.map {
+ margin: 6em 0 0;
+
+ h3 {
+ // @include custom-sans(light);
+
+ text-align: center;
+
+ // @extend %ornamental-divider-after;
+ }
+
+ iframe {
+ border: 0;
+ height: 400px;
+ margin: 2em 0 0;
+ }
+
+ @media (min-width: $mobile-tablet-portrait) {
+ iframe {
+ height: 600px;
+ }
+ }
+}
+
+#activities {
+ // clear: both;
+
+ // @extend %clearfix;
+
+ @include unlisted;
+
+ padding: 1em 0 0 0;
+
+ // card variations
+ $types: participant ok remove, owner edit edit;
+
+ .activity-day {
+ clear: both;
+
+ h1 {
+ margin-top: 0;
+ padding-top: 0.67em;
+ }
+ }
+
+ li {
+ display: block;
+ margin: 0 0 2px 0;
+ text-align: center;
+
+ // icon in the upper right,
+ // shows up only if owner or participant
+ span.icon {
+ opacity: 1;
+ position: absolute;
+ right: 15px;
+ top: 15px;
+
+ transition: opacity 0.25s;
+ }
+
+ // select icon based on card variation
+ // @each $type in $types {
+ // &.#{nth($type, 1)} {
+ // span.icon {
+ // @extend %icon-#{nth($type, 2)};
+ // }
+ // }
+ // }
+
+ // links are actually stacked in this case
+ // as one card has to support many purposes
+ a {
+ border: 0;
+
+ // link to show action, usually covers whole card
+ // on hover appears as secondary button above title
+ &.details {
+ display: block;
+ height: 100%;
+ left: 0;
+ position: absolute;
+ top: 0;
+ width: 100%;
+ z-index: 100;
+
+ span {
+ // @extend %secondary-button;
+
+ background: $medium-gray;
+ margin: 20em 0 0;
+ opacity: 0;
+ }
+ }
+ }
+
+ // card background and wrapper
+ .container {
+ background: lighten($extra-light-gray, 5);
+ border: 1px solid lighten($extra-light-gray, 5);
+ height: 25em;
+ margin: 0 1px;
+ overflow: hidden;
+ padding: 2.5em 1em 1em 1em;
+ position: relative;
+
+ transition: all 0.35s ease-in-out;
+ }
+
+ // all default text: title, organizer, date etc.
+ .labels {
+ color: #ccc;
+ margin: 1.5em 0 0 0;
+
+ // title
+ h4 {
+ // @include custom-sans(light);
+
+ font-size: 1.375em;
+ margin: 0;
+ padding: 0 0.72727em;
+
+ transition: all 0.15s ease-out;;
+
+ // @extend %ornamental-divider-before;
+
+ // @extend %ornamental-divider-after;
+
+ &:before,
+ &:after {
+ margin: 0.2em auto;
+ width: 20px;
+ }
+
+ &:before {
+ margin: 0 auto;
+ width: 0;
+ }
+ }
+
+ // creator and date/time rows
+ p {
+ opacity: 1;
+
+ transition: opacity 0.1s;
+
+ &.creator {
+ margin: 0.5em 0;
+
+ // @include custom-sans(medium);
+
+ // @extend %smaller-text;
+
+ text-transform: uppercase;
+ }
+
+ &.time {
+ border-top: 1px solid $light-gray;
+ bottom: 0;
+ left: 1em;
+ padding: 0.75em 0 0;
+
+ // @include custom-serif(bold);
+
+ position: absolute;
+ right: 1em;
+ }
+ }
+ }
+
+ //
+ .progress {
+ display: inline-block;
+ }
+
+ // the big button appearing on hover
+ .action {
+ left: 0;
+ opacity: 0;
+ position: absolute;
+ right: 0;
+ top: 5em;
+ transform: scale 0.9;
+
+ transition: all 0.35s ease-in-out 0;
+ z-index: 1001;
+
+ a, button {
+ // @extend %large-icon-button-ok;
+ }
+ }
+
+ // select action type based on card variation
+ @each $type in $types {
+ &.#{nth($type, 1)} {
+ .action {
+ a, button {
+ // @extend %large-icon-button-#{nth($type, 3)};
+ }
+ }
+ }
+ }
+
+ // HOVER state
+ &:hover {
+ cursor: pointer;
+
+ .container {
+ background: white;
+ border-color: $extra-light-gray;
+ box-shadow: 0 0 25px transparentize(#000, 0.85);
+ z-index: 9001;
+ }
+
+ span.icon {
+ opacity: 0;
+
+ transition: opacity 0.25s;
+ }
+
+ a.details {
+ span {
+ opacity: 1;
+
+ transition: all 0.25s ease-in-out;
+ }
+ }
+
+ .progress-wrapper,
+ .container > .progress {
+ transition: all 0.15s ease-out;;
+
+ opacity: 0;
+
+ transform: translate(0, -9em);
+ }
+
+ &.full.default,
+ &.past {
+ .progress-wrapper,
+ .container > .progress {
+ transition: all 0.15s ease-out;;
+
+ opacity: 0.5;
+
+ transform: translate(0, 0);
+ }
+ }
+
+ .labels {
+ h4 {
+ transition: all 0.15s ease-out;;
+
+ transform: translate(0, 2.5em);
+
+ &:before {
+ margin: 0 auto 0.5em;
+ width: 50%;
+ }
+
+ &:after {
+ width: 0;
+ }
+ }
+
+ p {
+ opacity: 0;
+
+ transition: opacity 0.1s;
+ }
+
+ .requires_eurucamp_ticket {
+ opacity: 0;
+
+ transition: opacity 0.1s;
+ }
+ }
+
+ .action {
+ opacity: 1;
+
+ transform: scale(1);
+ transition: all 0.15s ease-out 0.15s;
+ }
+ }
+ }
+
+ @media (min-width: $mobile-tablet-portrait) {
+ li {
+ // @include span-columns(2);
+ }
+ }
+
+
+ @media (min-width: $mobile-tablet-landscape) {
+ li {
+ // @include span-columns(2);
+ }
+ }
+}
diff --git a/app/assets/stylesheets/partials/activities/_shared.scss b/app/assets/stylesheets/partials/activities/_shared.scss
new file mode 100644
index 00000000..400e7133
--- /dev/null
+++ b/app/assets/stylesheets/partials/activities/_shared.scss
@@ -0,0 +1,28 @@
+// wrapper around image + canvas
+.progress-wrapper {
+ margin: 0 auto;
+ padding: 6px;
+ transition: all 0.15s ease-out;
+ width: 162px;
+
+ width: 162px;
+
+ canvas {
+ z-index: 99 !important;
+ }
+}
+
+// big round image
+.progress {
+ background-image: image-url("shared/activity_placeholder.jpg");
+ background-position: center;
+ background-size: cover;
+ border-radius: 75px;
+ height: 150px;
+ width: 150px;
+}
+
+img.requires_eurucamp_ticket {
+ height: 40px;
+ width: 40px;
+}
diff --git a/app/assets/stylesheets/partials/activities/_show.scss b/app/assets/stylesheets/partials/activities/_show.scss
new file mode 100644
index 00000000..a79e38a8
--- /dev/null
+++ b/app/assets/stylesheets/partials/activities/_show.scss
@@ -0,0 +1,190 @@
+$types: participant ok remove, owner edit edit;
+
+#activity {
+ header {
+ p.info {
+ background: $extra-light-gray;
+ border: 1px solid $light-gray;
+ padding: 1em;
+
+ // @include custom-sans(medium);
+ }
+ }
+
+ .action {
+ position: absolute;
+ right: 0;
+ top: 0;
+
+ a, button {
+ // @extend %icon-button-ok;
+ }
+
+ // select action type based on card variation
+ // @each $type in $types {
+ // &.#{nth($type, 1)} {
+ // a, button {
+ // @extend %icon-button-#{nth($type, 3)};
+ // }
+ // }
+ // }
+ }
+
+ section {
+ position: relative;
+
+ &.description {
+ // @include custom-serif;
+
+ line-height: 1.35em;
+ margin-bottom: 2em;
+
+ h1, h2, h3, h4, h5, h6 {
+ // @include custom-sans(bold);
+
+ font-size: 1em;
+ margin: 1.5em 0 0;
+ text-transform: uppercase;
+ }
+ }
+
+ &.overview {
+ margin-bottom: 2em;
+ text-align: center;
+
+ .progress-wrapper,
+ .progress {
+ display: none;
+ }
+
+ p {
+ font-size: 1.25em;
+ margin: 1em 0 0;
+ }
+
+ a {
+ // @extend %secondary-button;
+
+ margin: 1em 0;
+ }
+
+ .participants {
+ clear: both;
+ padding: 2em 0;
+ width: 100%;
+
+ h3 {
+ // @include custom-sans(light);
+
+ text-align: center;
+
+ // @extend %ornamental-divider-after;
+ }
+
+ ul {
+ @include unlisted;
+
+ text-align: center;
+ }
+
+ li {
+ display: inline-block;
+ padding: 0 5px;
+ }
+
+ img {
+ border-radius: 24px;
+ width: 48px;
+ }
+ }
+ }
+
+ &.details {
+ dl.wrapper {
+ // @extend %clearfix;
+
+ border-bottom: 1px solid $light-gray;
+ }
+
+ dt, dd {
+ border-top: 1px solid $light-gray;
+ float: left;
+ line-height: 3em;
+ line-height: 1.35em;
+ padding: 1em 0;
+ width: 50%;
+ }
+
+ dt {
+ // @include custom-sans(medium);
+
+ clear: left;
+ }
+
+ dd {
+ // @include custom-serif;
+
+ margin: 0;
+ }
+ }
+ }
+
+ @media (min-width: $mobile-phone) {
+ section {
+ &.overview {
+ .progress-wrapper {
+ display: block;
+ height: 274px;
+ padding: 12px;
+ width: 274px;
+ }
+
+ .progress {
+ border-radius: 125px;
+ display: block;
+ height: 250px;
+ width: 250px;
+ }
+ }
+ }
+ }
+
+
+ @media (min-width: $mobile-tablet-portrait) {
+ section {
+ width: percentage(1 / 3);
+
+ &.overview {
+ float: left;
+ left: percentage(1 / 3);
+ }
+
+ &.description {
+ float: left;
+ left: -(percentage(1 / 3));
+
+ .wrapper {
+ margin-right: 50px;
+ }
+ }
+
+ &.details {
+ float: right;
+
+ dl.wrapper {
+ margin-left: 50px;
+ }
+ }
+ }
+ }
+
+
+ .meeting-point-map {
+ display: none;
+ margin-left: 50px;
+
+ img {
+ width: 100%;
+ }
+ }
+}
diff --git a/app/assets/stylesheets/partials/user/_edit.scss b/app/assets/stylesheets/partials/user/_edit.scss
new file mode 100644
index 00000000..f249396c
--- /dev/null
+++ b/app/assets/stylesheets/partials/user/_edit.scss
@@ -0,0 +1,4 @@
+label.show_participation {
+ display: inline-block !important;
+ margin-bottom: 1.25em;
+}
diff --git a/app/assets/stylesheets/vendor/animate-custom.scss b/app/assets/stylesheets/vendor/animate-custom.scss
new file mode 100644
index 00000000..13b9f74e
--- /dev/null
+++ b/app/assets/stylesheets/vendor/animate-custom.scss
@@ -0,0 +1,127 @@
+@mixin animated {
+ animation-fill-mode:both;
+ animation-duration:1s;
+}
+
+@keyframes flipInX {
+ 0% {
+ transform: perspective(400px) rotateX(90deg);
+ opacity: 0;
+ }
+
+ 40% {
+ transform: perspective(400px) rotateX(-10deg);
+ }
+
+ 70% {
+ transform: perspective(400px) rotateX(10deg);
+ }
+
+ 100% {
+ transform: perspective(400px) rotateX(0deg);
+ opacity: 1;
+ }
+}
+
+@mixin flip-in-x {
+ backface-visibility: visible !important;
+ animation-name: flipInX;
+}
+
+@keyframes flipInY {
+ 0% {
+ transform: perspective(400px) rotateY(90deg);
+ opacity: 0;
+ }
+
+ 40% {
+ transform: perspective(400px) rotateY(-10deg);
+ }
+
+ 70% {
+ transform: perspective(400px) rotateY(10deg);
+ }
+
+ 100% {
+ transform: perspective(400px) rotateY(0deg);
+ opacity: 1;
+ }
+}
+
+@mixin flip-in-y {
+ backface-visibility: visible !important;
+ animation-name: flipInY;
+}
+
+@keyframes fadeIn {
+ 0% {opacity: 0;}
+ 100% {opacity: 1;}
+}
+
+@keyframes fadeInLeft {
+ 0% {
+ opacity: 0;
+ transform: translateX(-20px);
+ }
+
+ 100% {
+ opacity: 1;
+ transform: translateX(0);
+ }
+}
+
+@mixin fade-in-left {
+ animation-name: fadeInLeft;
+}
+
+@mixin fade-in {
+ animation-name: fadeIn;
+}
+
+@keyframes fadeInUp {
+ 0% {
+ opacity: 0;
+ transform: translateY(20px);
+ }
+
+ 100% {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+@mixin fade-in-up {
+ animation-name: fadeInUp;
+}
+
+@keyframes fadeInDown {
+ 0% {
+ opacity: 0;
+ transform: translateY(-20px);
+ }
+
+ 100% {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+@mixin fade-in-down {
+ animation-name: fadeInDown;
+}
+
+@keyframes fadeInRight {
+ 0% {
+ opacity: 0;
+ transform: translateX(20px);
+ }
+
+ 100% {
+ opacity: 1;
+ transform: translateX(0);
+ }
+}
+
+@mixin fade-in-right {
+ animation-name: fadeInRight;
+}
diff --git a/app/assets/stylesheets/vendor/normalize.css b/app/assets/stylesheets/vendor/normalize.css
new file mode 100644
index 00000000..d4210aac
--- /dev/null
+++ b/app/assets/stylesheets/vendor/normalize.css
@@ -0,0 +1,504 @@
+/*! normalize.css v1.0.1 | MIT License | git.io/normalize */
+
+/* ==========================================================================
+ HTML5 display definitions
+ ========================================================================== */
+
+/*
+ * Corrects `block` display not defined in IE 6/7/8/9 and Firefox 3.
+ */
+
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+nav,
+section,
+summary {
+ display: block;
+}
+
+/*
+ * Corrects `inline-block` display not defined in IE 6/7/8/9 and Firefox 3.
+ */
+
+audio,
+canvas,
+video {
+ display: inline-block;
+ *display: inline;
+ *zoom: 1;
+}
+
+/*
+ * Prevents modern browsers from displaying `audio` without controls.
+ * Remove excess height in iOS 5 devices.
+ */
+
+audio:not([controls]) {
+ display: none;
+ height: 0;
+}
+
+/*
+ * Addresses styling for `hidden` attribute not present in IE 7/8/9, Firefox 3,
+ * and Safari 4.
+ * Known issue: no IE 6 support.
+ */
+
+[hidden] {
+ display: none;
+}
+
+/* ==========================================================================
+ Base
+ ========================================================================== */
+
+/*
+ * 1. Corrects text resizing oddly in IE 6/7 when body `font-size` is set using
+ * `em` units.
+ * 2. Prevents iOS text size adjust after orientation change, without disabling
+ * user zoom.
+ */
+
+html {
+ font-size: 100%; /* 1 */
+ -webkit-text-size-adjust: 100%; /* 2 */
+ -ms-text-size-adjust: 100%; /* 2 */
+}
+
+/*
+ * Addresses `font-family` inconsistency between `textarea` and other form
+ * elements.
+ */
+
+html,
+button,
+input,
+select,
+textarea {
+ font-family: sans-serif;
+}
+
+/*
+ * Addresses margins handled incorrectly in IE 6/7.
+ */
+
+body {
+ margin: 0;
+}
+
+/* ==========================================================================
+ Links
+ ========================================================================== */
+
+/*
+ * Addresses `outline` inconsistency between Chrome and other browsers.
+ */
+
+a:focus {
+ outline: thin dotted;
+}
+
+/*
+ * Improves readability when focused and also mouse hovered in all browsers.
+ */
+
+a:active,
+a:hover {
+ outline: 0;
+}
+
+/* ==========================================================================
+ Typography
+ ========================================================================== */
+
+/*
+ * Addresses font sizes and margins set differently in IE 6/7.
+ * Addresses font sizes within `section` and `article` in Firefox 4+, Safari 5,
+ * and Chrome.
+ */
+
+h1 {
+ font-size: 2em;
+ margin: 0.67em 0;
+}
+
+h2 {
+ font-size: 1.5em;
+ margin: 0.83em 0;
+}
+
+h3 {
+ font-size: 1.17em;
+ margin: 1em 0;
+}
+
+h4 {
+ font-size: 1em;
+ margin: 1.33em 0;
+}
+
+h5 {
+ font-size: 0.83em;
+ margin: 1.67em 0;
+}
+
+h6 {
+ font-size: 0.75em;
+ margin: 2.33em 0;
+}
+
+/*
+ * Addresses styling not present in IE 7/8/9, Safari 5, and Chrome.
+ */
+
+abbr[title] {
+ border-bottom: 1px dotted;
+}
+
+/*
+ * Addresses style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome.
+ */
+
+b,
+strong {
+ font-weight: bold;
+}
+
+blockquote {
+ margin: 1em 40px;
+}
+
+/*
+ * Addresses styling not present in Safari 5 and Chrome.
+ */
+
+dfn {
+ font-style: italic;
+}
+
+/*
+ * Addresses styling not present in IE 6/7/8/9.
+ */
+
+mark {
+ background: #ff0;
+ color: #000;
+}
+
+/*
+ * Addresses margins set differently in IE 6/7.
+ */
+
+p,
+pre {
+ margin: 1em 0;
+}
+
+/*
+ * Corrects font family set oddly in IE 6, Safari 4/5, and Chrome.
+ */
+
+code,
+kbd,
+pre,
+samp {
+ font-family: monospace, serif;
+ _font-family: 'courier new', monospace;
+ font-size: 1em;
+}
+
+/*
+ * Improves readability of pre-formatted text in all browsers.
+ */
+
+pre {
+ white-space: pre;
+ white-space: pre-wrap;
+ word-wrap: break-word;
+}
+
+/*
+ * Addresses CSS quotes not supported in IE 6/7.
+ */
+
+q {
+ quotes: none;
+}
+
+/*
+ * Addresses `quotes` property not supported in Safari 4.
+ */
+
+q:before,
+q:after {
+ content: '';
+ content: none;
+}
+
+/*
+ * Addresses inconsistent and variable font size in all browsers.
+ */
+
+small {
+ font-size: 80%;
+}
+
+/*
+ * Prevents `sub` and `sup` affecting `line-height` in all browsers.
+ */
+
+sub,
+sup {
+ font-size: 75%;
+ line-height: 0;
+ position: relative;
+ vertical-align: baseline;
+}
+
+sup {
+ top: -0.5em;
+}
+
+sub {
+ bottom: -0.25em;
+}
+
+/* ==========================================================================
+ Lists
+ ========================================================================== */
+
+/*
+ * Addresses margins set differently in IE 6/7.
+ */
+
+dl,
+menu,
+ol,
+ul {
+ margin: 1em 0;
+}
+
+dd {
+ margin: 0 0 0 40px;
+}
+
+/*
+ * Addresses paddings set differently in IE 6/7.
+ */
+
+menu,
+ol,
+ul {
+ padding: 0 0 0 40px;
+}
+
+/*
+ * Corrects list images handled incorrectly in IE 7.
+ */
+
+nav ul,
+nav ol {
+ list-style: none;
+ list-style-image: none;
+}
+
+/* ==========================================================================
+ Embedded content
+ ========================================================================== */
+
+/*
+ * 1. Removes border when inside `a` element in IE 6/7/8/9 and Firefox 3.
+ * 2. Improves image quality when scaled in IE 7.
+ */
+
+img {
+ border: 0; /* 1 */
+ -ms-interpolation-mode: bicubic; /* 2 */
+}
+
+/*
+ * Corrects overflow displayed oddly in IE 9.
+ */
+
+svg:not(:root) {
+ overflow: hidden;
+}
+
+/* ==========================================================================
+ Figures
+ ========================================================================== */
+
+/*
+ * Addresses margin not present in IE 6/7/8/9, Safari 5, and Opera 11.
+ */
+
+figure {
+ margin: 0;
+}
+
+/* ==========================================================================
+ Forms
+ ========================================================================== */
+
+/*
+ * Corrects margin displayed oddly in IE 6/7.
+ */
+
+form {
+ margin: 0;
+}
+
+/*
+ * Define consistent border, margin, and padding.
+ */
+
+fieldset {
+ border: 1px solid #c0c0c0;
+ margin: 0 2px;
+ padding: 0.35em 0.625em 0.75em;
+}
+
+/*
+ * 1. Corrects color not being inherited in IE 6/7/8/9.
+ * 2. Corrects text not wrapping in Firefox 3.
+ * 3. Corrects alignment displayed oddly in IE 6/7.
+ */
+
+legend {
+ border: 0; /* 1 */
+ padding: 0;
+ white-space: normal; /* 2 */
+ *margin-left: -7px; /* 3 */
+}
+
+/*
+ * 1. Corrects font size not being inherited in all browsers.
+ * 2. Addresses margins set differently in IE 6/7, Firefox 3+, Safari 5,
+ * and Chrome.
+ * 3. Improves appearance and consistency in all browsers.
+ */
+
+button,
+input,
+select,
+textarea {
+ font-size: 100%; /* 1 */
+ margin: 0; /* 2 */
+ vertical-align: baseline; /* 3 */
+ *vertical-align: middle; /* 3 */
+}
+
+/*
+ * Addresses Firefox 3+ setting `line-height` on `input` using `!important` in
+ * the UA stylesheet.
+ */
+
+button,
+input {
+ line-height: normal;
+}
+
+/*
+ * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
+ * and `video` controls.
+ * 2. Corrects inability to style clickable `input` types in iOS.
+ * 3. Improves usability and consistency of cursor style between image-type
+ * `input` and others.
+ * 4. Removes inner spacing in IE 7 without affecting normal text inputs.
+ * Known issue: inner spacing remains in IE 6.
+ */
+
+button,
+html input[type="button"], /* 1 */
+input[type="reset"],
+input[type="submit"] {
+ -webkit-appearance: button; /* 2 */
+ cursor: pointer; /* 3 */
+ *overflow: visible; /* 4 */
+}
+
+/*
+ * Re-set default cursor for disabled elements.
+ */
+
+button[disabled],
+input[disabled] {
+ cursor: default;
+}
+
+/*
+ * 1. Addresses box sizing set to content-box in IE 8/9.
+ * 2. Removes excess padding in IE 8/9.
+ * 3. Removes excess padding in IE 7.
+ * Known issue: excess padding remains in IE 6.
+ */
+
+input[type="checkbox"],
+input[type="radio"] {
+ box-sizing: border-box; /* 1 */
+ padding: 0; /* 2 */
+ *height: 13px; /* 3 */
+ *width: 13px; /* 3 */
+}
+
+/*
+ * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome.
+ * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome
+ * (include `-moz` to future-proof).
+ */
+
+input[type="search"] {
+ -webkit-appearance: textfield; /* 1 */
+ -moz-box-sizing: content-box;
+ -webkit-box-sizing: content-box; /* 2 */
+ box-sizing: content-box;
+}
+
+/*
+ * Removes inner padding and search cancel button in Safari 5 and Chrome
+ * on OS X.
+ */
+
+input[type="search"]::-webkit-search-cancel-button,
+input[type="search"]::-webkit-search-decoration {
+ -webkit-appearance: none;
+}
+
+/*
+ * Removes inner padding and border in Firefox 3+.
+ */
+
+button::-moz-focus-inner,
+input::-moz-focus-inner {
+ border: 0;
+ padding: 0;
+}
+
+/*
+ * 1. Removes default vertical scrollbar in IE 6/7/8/9.
+ * 2. Improves readability and alignment in all browsers.
+ */
+
+textarea {
+ overflow: auto; /* 1 */
+ vertical-align: top; /* 2 */
+}
+
+/* ==========================================================================
+ Tables
+ ========================================================================== */
+
+/*
+ * Remove most spacing between table cells.
+ */
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb
index 50d1891a..23e57a3f 100644
--- a/app/controllers/activities_controller.rb
+++ b/app/controllers/activities_controller.rb
@@ -1,2 +1,75 @@
-class ActivitiesController < ApplicationController
+class ActivitiesController < ApiController
+ respond_to :html
+
+ skip_before_action :authenticate_user!, only: [:index, :show]
+ before_action :load_resource, only: [:show, :edit, :update, :destroy]
+ authorize_resource only: [:edit, :update, :destroy]
+
+ def index
+ @activities_per_day = current_event.activities_per_day(current_user, query_params[:search], query_params[:filter])
+ @counters = current_event.counters(current_user)
+ respond_with(@activities_per_day)
+ end
+
+ def show
+ respond_with(@activity)
+ end
+
+ def new
+ @activity = current_event.new_activity(current_user, {})
+ respond_with(@activity)
+ end
+
+ def edit
+ respond_with(@activity)
+ end
+
+ def create
+ @activity = current_event.new_activity(current_user, sanitized_params)
+ type = @activity.save ? :notice : :error
+ flash[type] = I18n.t("new_activity.#{type}")
+ respond_with(@activity, location: activities_path)
+ end
+
+ def update
+ if @activity
+ type = @activity.update_attributes(sanitized_params) ? :notice : :error
+ flash[type] = I18n.t("edit_activity.#{type}")
+ end
+ respond_with(@activity, location: edit_activity_path(@activity))
+ end
+
+ def destroy
+ if @activity && params[:confirm_delete] && @activity.destroy
+ redirect_to root_path, notice: I18n.t("destroy_activity.notice")
+ else
+ flash[:error] = I18n.t("destroy_activity.error")
+ render :edit
+ end
+ end
+
+ private
+
+ def load_resource
+ @activity = current_event.activity(params[:id]).try(:decorate)
+ end
+
+ def sanitized_params
+ params.require(:activity)
+ .permit(:start_time,
+ :end_time,
+ :name,
+ :location,
+ :requirements,
+ :requires_eurucamp_ticket,
+ :description,
+ :limit_of_participants,
+ :anytime,
+ :image_url)
+ end
+
+ def query_params
+ params.permit(:search, :filter)
+ end
+
end
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
new file mode 100644
index 00000000..82bd5817
--- /dev/null
+++ b/app/controllers/api_controller.rb
@@ -0,0 +1,7 @@
+require_dependency 'api_responder'
+
+class ApiController < ApplicationController
+
+ self.responder = ApiResponder
+
+end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d83690e1..efac8ae2 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -2,4 +2,43 @@ 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
+ helper_method :current_event
+ layout :layout_by_resource
+
+ before_action :clean_up_session
+ before_action :authenticate_user!
+
+ rescue_from CanCan::AccessDenied, with: :rescue_access_denied
+ rescue_from ActiveRecord::RecordNotFound, with: :rescue_record_not_found
+
+ def current_event
+ @current_event ||= Event.new
+ end
+
+ def not_found
+ if request.xhr?
+ render nothing: true, status: 404
+ else
+ raise ActionController::RoutingError.new('Not Found')
+ end
+ end
+
+ private
+
+ def clean_up_session
+ session[:omniauth] = nil
+ end
+
+ def rescue_access_denied
+ render nothing: true, status: 401
+ end
+
+ def rescue_record_not_found
+ not_found
+ end
+
+ def layout_by_resource
+ devise_controller? ? 'user' : 'application'
+ end
+
end
diff --git a/app/controllers/authentications_controller.rb b/app/controllers/authentications_controller.rb
new file mode 100644
index 00000000..db26c69b
--- /dev/null
+++ b/app/controllers/authentications_controller.rb
@@ -0,0 +1,43 @@
+class AuthenticationsController < ApplicationController
+ skip_before_action :authenticate_user!
+
+ rescue_from ActionController::RedirectBackError do |exception|
+ redirect_to edit_user_registration_path
+ end
+
+ def create
+ omniauth = request.env['omniauth.auth']
+ provider, uid = omniauth.values_at('provider', 'uid')
+ authentication = Authentication.where(provider: provider, uid: uid).first
+
+ if authentication
+ flash[:notice] = 'Signed in successfully'
+ sign_in_and_redirect(:user, authentication.user)
+ elsif current_user
+ current_user.authentications.find_or_create_by(provider: provider, uid: uid)
+ current_user.apply_provider_handle(omniauth)
+ current_user.save
+ flash[:notice] = 'Connected successfully'
+ redirect_back(fallback_location: edit_user_registration_url)
+ else
+ user = User.new
+ user.apply_omniauth(omniauth)
+ if user.save
+ flash[:notice] = 'Signed in successfully'
+ sign_in_and_redirect(:user, user)
+ else
+ session[:omniauth] = omniauth.except(:extra)
+ redirect_to new_user_registration_url
+ end
+ end
+ end
+
+ def destroy
+ @authentication = current_user.authentications.find(params[:id])
+ authorize!(:destroy, @authentication)
+ @authentication.destroy
+
+ flash[:notice] = 'Successfully disconnected provider'
+ redirect_to authentications_url
+ end
+end
diff --git a/app/controllers/participations_controller.rb b/app/controllers/participations_controller.rb
new file mode 100644
index 00000000..70684bde
--- /dev/null
+++ b/app/controllers/participations_controller.rb
@@ -0,0 +1,28 @@
+class ParticipationsController < ApiController
+ respond_to :js, :html
+
+ def create
+ unless current_activity.full?
+ @participation = current_activity.new_participation(current_user)
+ @participation.save
+ end
+
+ respond_with(current_activity.reload, @participation) do |format|
+ format.html { redirect_back(fallback_location: activity_url(current_activity)) }
+ end
+ end
+
+ def destroy
+ @participation = current_activity.participation(current_user)
+ authorize!(:destroy, @participation)
+ @participation.destroy
+ respond_with(current_activity.reload, @participation, location: request.referer)
+ end
+
+ private
+
+ def current_activity
+ @current_activity ||= current_event.activity(params[:activity_id]).try(:decorate)
+ end
+
+end
diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb
new file mode 100644
index 00000000..575ea90d
--- /dev/null
+++ b/app/controllers/passwords_controller.rb
@@ -0,0 +1,3 @@
+class PasswordsController < Devise::PasswordsController
+ skip_before_action :authenticate_user!
+end
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
new file mode 100644
index 00000000..f9c946b1
--- /dev/null
+++ b/app/controllers/registrations_controller.rb
@@ -0,0 +1,57 @@
+class RegistrationsController < Devise::RegistrationsController
+ skip_before_action :authenticate_user!, only: :create
+ skip_before_action :clean_up_session, only: [:new, :create]
+
+ helper_method :during_oauth_flow?
+
+ def create
+ super
+ session[:omniauth] = nil unless @user.new_record?
+ end
+
+ def update
+ self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
+ prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)
+
+ if resource.update_without_password(editable_params)
+ if is_navigational_format?
+ flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
+ :update_needs_confirmation : :updated
+ set_flash_message :notice, flash_key
+ end
+ sign_in resource_name, resource, bypass: true
+ respond_with resource, location: after_update_path_for(resource)
+ else
+ clean_up_passwords resource
+ respond_with resource
+ end
+ end
+
+ private
+
+ def during_oauth_flow?
+ !current_user && @user.new_record? && session[:omniauth].present?
+ end
+
+ def build_resource(*args)
+ super.tap do |user|
+ if user && session[:omniauth]
+ user.apply_omniauth(session[:omniauth])
+ user.valid?
+ end
+ end
+ end
+
+ def after_update_path_for(resource)
+ edit_user_registration_path
+ end
+
+ def sign_up_params
+ editable_params
+ end
+
+ def editable_params
+ params.require(:user).permit(:name, :email, :password, :password_confirmation, :show_participation)
+ end
+
+end
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
new file mode 100644
index 00000000..c743da04
--- /dev/null
+++ b/app/controllers/sessions_controller.rb
@@ -0,0 +1,3 @@
+class SessionsController < Devise::SessionsController
+ skip_before_action :authenticate_user!
+end
diff --git a/app/decorators/activity_decorator.rb b/app/decorators/activity_decorator.rb
new file mode 100644
index 00000000..3952aa9c
--- /dev/null
+++ b/app/decorators/activity_decorator.rb
@@ -0,0 +1,86 @@
+class ActivityDecorator < Draper::Decorator
+ delegate_all
+
+ def css_classes
+ classes = [relation_ship_with(h.current_user)]
+ classes << "today" if object.today?
+ classes << "past" if object.in_past?
+ classes << "full" if object.full?
+ classes << "anytime" if object.anytime?
+ classes.join(" ")
+ end
+
+ def creator_name
+ if creator
+ creator.name.blank? ? creator.email : creator.name
+ end
+ end
+
+ def relation_ship_with(user)
+ if user.nil? then "default"
+ elsif object.creator == user then "owner"
+ elsif object.participants.include? user then "participant"
+ else "default"
+ end
+ end
+
+ def status
+ if object.anytime? then ""
+ elsif object.today? then "today"
+ elsif object.in_past? then "past"
+ elsif object.upcoming? then "upcoming"
+ else "archive"
+ end
+ end
+
+ def description_markdown
+ object.description ? markdown(object.description) : 'No description added.'.html_safe
+ end
+
+ def requirements_markdown
+ object.requirements ? markdown(object.requirements) : ''
+ end
+
+ def room_left
+ if object.anybody_can_join? then ""
+ else
+ left = open_spots
+ if left == 1 then I18n.t("activities.room_left.one")
+ elsif left > 0 then I18n.t("activities.room_left.many", left: left)
+ else I18n.t("activities.room_left.none")
+ end
+ end
+ end
+
+ def open_spots
+ [[object.limit_of_participants - object.participations_count, 0].max, object.limit_of_participants ].min
+ end
+
+ def time
+ if object.anytime?
+ I18n.t("activities.anytime")
+ else
+ alpha, omega, out = object.start_time, object.end_time, ""
+
+ out << I18n.l(alpha, format: :nice_date)
+ out << " / "
+ out << I18n.l(alpha, format: :time_only)
+ out << " – "
+ unless alpha.to_date == omega.to_date
+ out << I18n.l(omega, format: :nice_date)
+ out << " / "
+ end
+ out << I18n.l(omega, format: :time_only)
+ end
+ end
+
+ private
+
+ def markdown(text)
+ options = %i(hard_wrap filter_html autolink no_intraemphasis fenced_code_blocks)
+ options = options.zip Array.new(options.size) { true }
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, Hash[*options.flatten])
+ markdown.render(text).html_safe
+ end
+
+end
diff --git a/app/decorators/participant_decorator.rb b/app/decorators/participant_decorator.rb
new file mode 100644
index 00000000..8a7a8318
--- /dev/null
+++ b/app/decorators/participant_decorator.rb
@@ -0,0 +1,13 @@
+class ParticipantDecorator < Draper::Decorator
+ def name
+ return 'Anonymous' unless object.show_participation
+ object.name
+ end
+
+ DEFAULT_AVATAR = 'http://www.gravatar.com/avatar/00000000000000000000000000000000.png?s=%{size}'
+
+ def avatar_url(size)
+ return DEFAULT_AVATAR % { size: size } unless object.show_participation
+ h.avatar_url(object, size)
+ end
+end
diff --git a/app/helpers/activity_form_helper.rb b/app/helpers/activity_form_helper.rb
new file mode 100644
index 00000000..cbcb5053
--- /dev/null
+++ b/app/helpers/activity_form_helper.rb
@@ -0,0 +1,45 @@
+module ActivityFormHelper
+
+ def fancy_datime_select(form, field, model)
+ field = field.to_s
+ haml_tag :fieldset, class: field.dasherize do
+ haml_tag :div, class: 'select' do
+ haml_concat form.datetime_select(field.to_sym, include_blank: true)
+ end
+ haml_tag :input, capture_attributes(field, model, 'date')
+ haml_tag :input, capture_attributes(field, model, 'time')
+ if model.errors[field].any?
+ haml_tag :span, model.errors[field].join(', '), class: 'validation-error-message'
+ end
+ end
+ end
+
+ private
+
+ def capture_attributes(field, model, type = 'date')
+ field = field.to_sym
+ format = "#{type}_only".to_sym
+
+ attributes = {
+ type: 'text',
+ class: "#{type}-capture #{field.to_s.dasherize}",
+ placeholder: l(current_event.send(field), format: "nice_#{type}".to_sym),
+ data: {
+ update: ".#{type}-capture.#{field == :start_time ? 'end' : 'start'}-time",
+ target: field,
+ value: parse_date(model.send(field), format)
+ }
+ }
+
+ if model.errors[field].any?
+ attributes[:class] << ' validation-error'
+ end
+
+ attributes
+ end
+
+ def parse_date(d, format)
+ l(d, format: format) rescue nil
+ end
+
+end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8c5d5f6a..d95af63b 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,22 +1,15 @@
module ApplicationHelper
- # Sets and formats document title
- #
- # @param [Mixed]
- # @param [String] Separator
- # @return [String] Title
- def title(t, separator = " | ")
- @title ||= []
- @title << t
- @title.flatten.compact.join(separator)
+ def gravatar_avatar_url(user, size)
+ gravatar_id = Digest::MD5::hexdigest(user.email).downcase
+ "http://gravatar.com/avatar/#{gravatar_id}.png?s=#{size}"
end
- # Sets body classes
- #
- # @param [Mixed]
- # @return [String] CSS classes
- def body_class(c = nil)
- @body_class ||= [controller.controller_name]
- @body_class << c
- @body_class.flatten.compact.uniq.join(" ")
+ def twitter_avatar_url(handle)
+ "https://twitter.com/#{handle}/profile_image?size=normal"
+ end
+
+ def avatar_url(user, size = 64)
+ return twitter_avatar_url(user.twitter_handle) if user.twitter_handle
+ gravatar_avatar_url(user, size)
end
end
diff --git a/app/helpers/html5_helper.rb b/app/helpers/html5_helper.rb
deleted file mode 100644
index 26edfd5c..00000000
--- a/app/helpers/html5_helper.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-module Html5Helper
-
- # Helper to display conditional html tags for IE
- # http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
- # has been lifted from the HTML5-rails gem: https://raw.github.com/sporkd/html5-rails/master/lib/html5/rails/helpers.rb
- def html_tag(attrs={})
- attrs.symbolize_keys!
- html = ""
- html << "\n"
- html << "\n"
- html << "\n"
- html << " "
-
- if block_given? && defined? Haml
- haml_concat(html.html_safe)
- haml_tag :html, attrs do
- haml_concat("".html_safe)
- yield
- end
- else
- html = html.html_safe
- html << tag(:html, attrs, true)
- html << " \n".html_safe
- html
- end
- end
-
-private
-
- def add_class(name, attrs)
- classes = attrs[:class] || ""
- classes.strip!
- classes = " " + classes if !classes.blank?
- classes = name + classes
- attrs.merge(:class => classes)
- end
-
-end
diff --git a/app/models/ability.rb b/app/models/ability.rb
new file mode 100644
index 00000000..05df2a23
--- /dev/null
+++ b/app/models/ability.rb
@@ -0,0 +1,9 @@
+class Ability
+ include CanCan::Ability
+
+ def initialize(user)
+ can [:edit, :update, :destroy], Activity, creator: user
+ can :destroy, Participation, participant: user
+ can :destroy, Authentication, user: user
+ end
+end
diff --git a/app/models/activity.rb b/app/models/activity.rb
new file mode 100644
index 00000000..095ed92a
--- /dev/null
+++ b/app/models/activity.rb
@@ -0,0 +1,165 @@
+class Activity < ActiveRecord::Base
+ DEFAULT_LIMIT = 100
+
+ attr_accessor :event
+ attr_writer :participation_source # DI
+
+ belongs_to :creator, class_name: "User"
+ has_many :participations, dependent: :destroy
+ has_many :participants, through: :participations, class_name: "User"
+
+ validates :start_time, presence: true, allow_blank: false, if: ->{ !anytime? }
+ validates :end_time, presence: true, allow_blank: false, if: ->{ !anytime? }
+ validates :anytime, presence: true, allow_blank: false, allow_nil: false, if: ->{ start_time.blank? && end_time.blank? }
+ validates :name, presence: true, allow_blank: false, uniqueness: true
+ validates :location, presence: true, allow_blank: false
+ validates :limit_of_participants, numericality: {greater_than: 0}, allow_nil: true
+ validate :time_frame_order, if: ->{ !anytime && event && start_time.present? && end_time.present? }
+ validate :during_the_event, if: ->{ !anytime && event && start_time.present? && end_time.present? }
+ validates :event, presence: true
+ validate :image_url_valid, if: ->{ image_url.present? }
+
+ before_validation :clear_time_frame, if: ->{ anytime }
+
+ class << self
+ def recent(limit = DEFAULT_LIMIT)
+ find_recent(limit)
+ end
+
+ def all_activities(limit = DEFAULT_LIMIT)
+ find_all(limit)
+ end
+
+ def today
+ find_today
+ end
+
+ def with_name_like(name)
+ find_with_name_like(name)
+ end
+
+ def created_by(user)
+ find_created_by(user)
+ end
+
+ def participated_by(user)
+ find_participated_by(user)
+ end
+
+ def order_by_start_time
+ t = Date.current.beginning_of_day
+ custom_order=<= :t OR anytime = true", t: 1.month.ago)
+ .limit(limit)
+ .order_by_start_time
+ end
+
+ def find_today
+ where("(NOT(start_time <= :t1 AND end_time = :t1 ) AND (start_time <= :t2 AND end_time >= :t1)) OR anytime=true", t1: Date.current.beginning_of_day, t2: Date.current.end_of_day).order_by_start_time
+ end
+
+ def find_with_name_like(name)
+ where("name ILIKE :q", q: "%#{name}%").order_by_start_time
+ end
+
+ def find_created_by(user)
+ where(creator_id: user).order_by_start_time
+ end
+
+ def find_participated_by(user)
+ joins(:participations).where(participations: { user_id: user }).order_by_start_time
+ end
+
+ end
+
+ def full_by
+ limit_of_participants.nil? ? 0 : [100.0 * participations_count / limit_of_participants.to_f, 100.0].min
+ end
+
+ def anybody_can_join?
+ limit_of_participants.nil?
+ end
+
+ def today?
+ return true if anytime?
+ t1, t2 = Date.current.beginning_of_day, Date.current.end_of_day
+ if start_time <= t1 && end_time == t1
+ false
+ else
+ start_time <= t2 && end_time >= t1
+ end
+ end
+
+ def upcoming?
+ start_time > Time.now.end_of_day
+ end
+
+ def in_past?
+ return false if anytime?
+ end_time < Date.current.beginning_of_day
+ end
+
+ def full?
+ participations_count >= limit_of_participants rescue false
+ end
+
+ def new_participation(user)
+ participation_source.call.tap do |participation|
+ participation.activity = self
+ participation.participant = user
+ end
+ end
+
+ def participation(user)
+ participations.find_by(user_id: user)
+ end
+
+ def dates
+ (start_time.to_date..end_time.to_date).to_a
+ end
+
+ private
+
+ def participation_source
+ @participation_source ||= Participation.public_method(:new)
+ end
+
+ def clear_time_frame
+ self.start_time, self.end_time = nil, nil
+ end
+
+ def time_frame_order
+ errors.add(:end_time, I18n.t("activities.errors.end_time.before_start")) if end_time < start_time
+ end
+
+ def during_the_event
+ errors.add(:start_time, I18n.t("activities.errors.end_time.too_early")) if start_time < event.start_time
+ errors.add(:end_time, I18n.t("activities.errors.end_time.too_late")) if end_time > event.end_time
+ end
+
+ def image_url_valid
+ errors.add(:image_url, I18n.t("activities.errors.image_url.protocol_not_supported")) unless URI.parse(image_url).kind_of?(URI::HTTP)
+ rescue URI::InvalidURIError
+ errors.add(:image_url, I18n.t("activities.errors.image_url.invalid"))
+ end
+
+end
diff --git a/app/models/authentication.rb b/app/models/authentication.rb
new file mode 100644
index 00000000..69a2df10
--- /dev/null
+++ b/app/models/authentication.rb
@@ -0,0 +1,3 @@
+class Authentication < ActiveRecord::Base
+ belongs_to :user
+end
diff --git a/app/models/event.rb b/app/models/event.rb
new file mode 100644
index 00000000..7aabb33e
--- /dev/null
+++ b/app/models/event.rb
@@ -0,0 +1,99 @@
+class Event
+ attr_writer :activity_source, :all_activities_fetcher, :recent_activities_fetcher # DI
+ attr_reader :name, :start_time, :end_time
+
+ def initialize(
+ name = Settings.event.name,
+ start_time = Settings.event.start_time,
+ end_time = Settings.event.end_time,
+ recent_activities_fetcher = ->{ Activity.recent },
+ all_activities_fetcher = ->{ Activity.all_activities })
+ @name, @start_time, @end_time = name, start_time, end_time
+ @recent_activities_fetcher = recent_activities_fetcher
+ @all_activities_fetcher = all_activities_fetcher
+ end
+
+ def new_activity(author, *args)
+ activity_source.call(*args).tap do |activity|
+ if activity
+ activity.start_time = @start_time if activity.start_time.blank?
+ activity.end_time = @end_time if activity.end_time.blank?
+ activity.event = self
+ activity.creator = author
+ end
+ end
+ end
+
+ def counters(user)
+ {
+ today: Activity.today.count(:all),
+ all: Activity.count,
+ participant: user.nil? ? 0 : Activity.participated_by(user).count(:all),
+ owner: user.nil? ? 0 : Activity.created_by(user).count(:all)
+ }
+ end
+
+ def activity(activity_id)
+ find_activity(activity_id).tap do |activity|
+ activity.event = self if activity
+ end
+ end
+
+ def recent_activities
+ fetch_recent
+ end
+
+ def all_activities
+ fetch_all_activities
+ end
+
+ def search_activities(author = nil, query_string = "", filter = "all")
+ query = all_activities
+ # TODO: consider using squeel in the future (doesn't work well with rails 4.beta1 ...)
+ query = query.with_name_like(query_string) if query_string.present?
+ if filter.present?
+ query = if filter == "today"
+ query.today
+ elsif filter == "owner"
+ query.created_by(author)
+ elsif filter == "participant"
+ query.participated_by(author)
+ else
+ query
+ end
+ end
+ query
+ end
+ alias_method :activities, :search_activities
+
+ def activities_per_day(author = nil, query_string = "", filter = "all")
+ activities = search_activities(author, query_string, filter)
+ activities = activities.to_a.sort_by { |activity| activity.start_time }
+
+ activities.each_with_object(Hash.new { [] }) do |activity, grouped_by_day|
+ activity.dates.each do |date|
+ grouped_by_day[date] += [activity]
+ end
+ end
+ end
+
+ private
+
+ def fetch_recent
+ @recent_activities_fetcher.()
+ end
+
+ def fetch_all_activities
+ @all_activities_fetcher.()
+ end
+
+ def find_activity(activity_id)
+ all_activities.where(id: activity_id).first
+ end
+
+ # Allow to replace db engine for tests
+ def activity_source
+ @activity_source ||= Activity.public_method(:new)
+ end
+
+end
diff --git a/app/models/participation.rb b/app/models/participation.rb
new file mode 100644
index 00000000..b32ae460
--- /dev/null
+++ b/app/models/participation.rb
@@ -0,0 +1,7 @@
+class Participation < ActiveRecord::Base
+ belongs_to :participant, class_name: "User", foreign_key: "user_id"
+ belongs_to :activity, counter_cache: true
+
+ validates :activity_id, presence: true, uniqueness: {scope: [:user_id]}
+ validates :user_id, presence: true
+end
diff --git a/app/models/user.rb b/app/models/user.rb
new file mode 100644
index 00000000..a9ac9e7f
--- /dev/null
+++ b/app/models/user.rb
@@ -0,0 +1,80 @@
+class User < ActiveRecord::Base
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :trackable, :validatable
+
+ has_many :authentications, dependent: :destroy
+ has_many :participations, dependent: :destroy
+ has_many :created_activities, class_name: "Activity", foreign_key: "creator_id", dependent: :nullify
+ has_many :activities_participated_in, through: :participations
+
+ validates :email, presence: true
+
+ # TODO: extract to module and then to a gem / engine
+ def apply_omniauth(omniauth)
+ provider, uid, info = omniauth.values_at('provider', 'uid', 'info')
+ unless info.blank?
+ self.email = info['email'] if email.blank?
+ self.name = info['name'] if name.blank?
+ end
+
+ apply_provider_handle(omniauth)
+ authentications.build(provider: provider, uid: uid)
+ end
+
+ def apply_provider_handle(omniauth)
+ provider, info = omniauth.values_at('provider', 'info')
+
+ # su*ks - refactor it
+ unless info.blank?
+ case provider
+ when /github/
+ self.github_handle = info['nickname'] if github_handle.blank?
+ when /twitter/
+ self.twitter_handle = info['nickname'] if twitter_handle.blank?
+ end
+ end
+ self
+ end
+
+ def update_without_password(params, *options)
+ if params[:password].blank?
+ params.delete(:password)
+ params.delete(:password_confirmation)
+ end
+
+ result = update_attributes(params, *options)
+ clean_up_passwords
+ result
+ end
+
+ def password_required?
+ !any_oauth_connected? && super
+ end
+
+ def no_oauth_connected?
+ !any_oauth_connected? && encrypted_password.present?
+ end
+
+ def connected_with_twitter?
+ provider_connected?('twitter')
+ end
+
+ def connected_with_github?
+ provider_connected?('github')
+ end
+
+ private
+
+ def any_oauth_connected?
+ authentications.any?
+ end
+
+ def provider_connected?(provider)
+ authentications.where(provider: provider).any?
+ end
+
+ def paper_exists?(paper)
+ papers.exists?(paper)
+ end
+
+end
diff --git a/app/views/activities/_action.html.haml b/app/views/activities/_action.html.haml
new file mode 100644
index 00000000..edf68c54
--- /dev/null
+++ b/app/views/activities/_action.html.haml
@@ -0,0 +1,17 @@
+- remote = defined?(remote) ? remote : true
+.action(class=type)
+ - case type
+ - when "owner"
+ = link_to edit_activity_path(activity), title: t("activities.edit.title") do
+ %span
+ = t("activities.edit.label")
+ - when "participant"
+ - unless activity.in_past?
+ = button_to activity_participation_path(activity), method: :delete, remote: remote, title: t("activities.leave.title") do
+ %span
+ = t("activities.leave.label")
+ - else
+ - unless activity.full? || activity.in_past?
+ = button_to activity_participation_path(activity), method: :post, remote: remote, title: t("activities.join.title") do
+ %span
+ = t("activities.join.label")
diff --git a/app/views/activities/_activity.html.haml b/app/views/activities/_activity.html.haml
new file mode 100644
index 00000000..c94b13a7
--- /dev/null
+++ b/app/views/activities/_activity.html.haml
@@ -0,0 +1,27 @@
+- type = activity.relation_ship_with(current_user)
+
+%li(id="activity-#{activity.id}" class="#{activity.css_classes}")
+ .container
+
+ = render "activities/progress", activity: activity
+
+ .labels
+ %h4
+ = activity.name
+ %p.creator
+ = activity.creator_name
+ - if activity.requires_eurucamp_ticket
+ = image_tag 'shared/isleofruby-2015.svg',
+ class: 'requires_eurucamp_ticket',
+ alt: t('activities.requires_eurucamp_ticket'),
+ title: t('activities.requires_eurucamp_ticket')
+ %p.time
+ = activity.time.html_safe
+
+ = render "activities/action", activity: activity, type: type, remote: true
+
+ %a.details(href="#{activity_path(activity)}" title="#{activity.name}")
+ %span
+ = t("activities.more_info.label")
+ - unless type == 'default'
+ %span.icon
diff --git a/app/views/activities/_activity_day.html.haml b/app/views/activities/_activity_day.html.haml
new file mode 100644
index 00000000..73ed1474
--- /dev/null
+++ b/app/views/activities/_activity_day.html.haml
@@ -0,0 +1,5 @@
+.activity-day
+ %h1= I18n.l(day.to_time, format: :nice_date)
+
+ %ul.activity-list
+ = render ActivityDecorator.decorate_collection(activities)
diff --git a/app/views/activities/_delete_form.html.haml b/app/views/activities/_delete_form.html.haml
new file mode 100644
index 00000000..efdb3d4e
--- /dev/null
+++ b/app/views/activities/_delete_form.html.haml
@@ -0,0 +1,8 @@
+= form_tag activity_path(@activity), method: :delete do
+
+ %fieldset
+ %label.inline
+ = check_box_tag :confirm_delete
+ = t("delete_activity_form.confirmation", count: @activity.participants.count)
+
+ = button_tag t("delete_activity_form.submit")
diff --git a/app/views/activities/_form.html.haml b/app/views/activities/_form.html.haml
new file mode 100644
index 00000000..ece864da
--- /dev/null
+++ b/app/views/activities/_form.html.haml
@@ -0,0 +1,50 @@
+= form_for @activity, html: { id: "new-activity" } do |f|
+
+ %label.name
+ = f.text_field :name, placeholder: t("activity_form.name.label"), class: "title"
+
+ %hr
+
+ - fancy_datime_select f, :start_time, @activity
+ %span.divider> –
+ - fancy_datime_select f, :end_time, @activity
+
+ %hr
+
+ %label.location>
+ = f.text_field :location, placeholder: t("activity_form.location.label")
+ %small
+ = t("activity_form.location.hint")
+ %a#show-map= t("activity_form.location.show-map")
+
+ %label.limit-of-participants>
+ = f.number_field :limit_of_participants, placeholder: 10, min: 1
+ %small
+ = t("activity_form.limit_of_participants.hint")
+
+ = image_tag 'activities/meeting_points.svg', class: 'meeting-point-map', id: 'meeting-point-map'
+
+ %label.requirements
+ = f.text_area :requirements, placeholder: t("activity_form.requirements.label"), rows: 6, class: "markdown", title: t("activity_form.markdown_hint")
+ %small
+ = t("activity_form.requirements.hint")
+
+ %fieldset.requires_eurucamp_ticket
+ %label.inline
+ = f.check_box :requires_eurucamp_ticket
+ = t("activity_form.requires_eurucamp_ticket.hint")
+
+ %label.description
+ = f.text_area :description, placeholder: t("activity_form.description.label"), rows: 8, class: "markdown", title: t("activity_form.markdown_hint")
+ %small
+ = t("activity_form.description.hint")
+
+ %label.image-url
+ = f.url_field :image_url, placeholder: t("activity_form.image_url.label")
+ .preview
+ %small
+ = t("activity_form.image_url.hint")
+
+ %button(type="submit")>
+ %span>
+ = t("common.submit.#{ @activity.new_record? ? "new" : "edit" }")
diff --git a/app/views/activities/_progress.html.haml b/app/views/activities/_progress.html.haml
new file mode 100644
index 00000000..5bc7bc9b
--- /dev/null
+++ b/app/views/activities/_progress.html.haml
@@ -0,0 +1 @@
+.progress(data-progress="#{ activity.full_by }" style="#{ "background-image: url(#{ activity.image_url })" if activity.image_url.present? }")
diff --git a/app/views/activities/edit.html.haml b/app/views/activities/edit.html.haml
new file mode 100644
index 00000000..1c6715da
--- /dev/null
+++ b/app/views/activities/edit.html.haml
@@ -0,0 +1,16 @@
+%h2
+ = t("edit_activity.title")
+
+%p.meta
+ = link_to t("activities.more_info.label_long"), @activity
+ %strong.divider
+ = t("common.or").downcase
+ = link_to t("activities.new.label").downcase, new_activity_path
+
+= render "form"
+
+%h2= t("activities.danger_zone")
+%p.meta
+ %strong= t("delete_activity_form.title")
+
+= render "delete_form"
diff --git a/app/views/activities/index.html.haml b/app/views/activities/index.html.haml
index 5a1284f3..da86527c 100644
--- a/app/views/activities/index.html.haml
+++ b/app/views/activities/index.html.haml
@@ -1 +1,33 @@
-Activities!
+%form.filters(action=activities_path method="GET" id="activities-filter")
+ %label>
+ = radio_button_tag "filter", "today", params[:filter] == "today", class: "radio"
+ = t("activities.filters.today")
+ %strong
+ = @counters[:today]
+ %label.all.selected>
+ = radio_button_tag "filter", "all", params[:filter] == "all" || params[:filter].nil?, class: "radio"
+ = t("activities.filters.all")
+ %strong
+ = @counters[:all]
+ %label.participant>
+ = radio_button_tag "filter", "participant", params[:filter] == "participant", class: "radio"
+ = t("activities.filters.participant")
+ %strong
+ = @counters[:participant]
+ %label.owner>
+ = radio_button_tag "filter", "owner", params[:filter] == "owner", class: "radio"
+ = t("activities.filters.owner")
+ %strong
+ = @counters[:owner]
+ %label.search
+ %input(type="text" name="search" placeholder="#{ t("activities.search.placeholder") }" value="#{ params[:search] }")
+ %button(type="submit")
+ = t("activities.filters.submit")
+
+%a#new-activity(href="#{ new_activity_path }" title="#{ t("activities.new.title") }")
+ %span
+ = t("activities.new.label")
+
+%section
+ - @activities_per_day.each do |day, activities|
+ = render 'activity_day', day: day, activities: activities
diff --git a/app/views/activities/new.html.haml b/app/views/activities/new.html.haml
new file mode 100644
index 00000000..91e8ee96
--- /dev/null
+++ b/app/views/activities/new.html.haml
@@ -0,0 +1,4 @@
+%h2
+ = t("new_activity.title")
+
+= render "form"
diff --git a/app/views/activities/show.html.haml b/app/views/activities/show.html.haml
new file mode 100644
index 00000000..dee70ef4
--- /dev/null
+++ b/app/views/activities/show.html.haml
@@ -0,0 +1,61 @@
+%h2
+ = @activity.name
+ - if @activity.requires_eurucamp_ticket
+ %br
+ = image_tag 'shared/IoR_illustration.svg',
+ class: 'requires_eurucamp_ticket',
+ alt: t('activities.requires_eurucamp_ticket'),
+ title: t('activities.requires_eurucamp_ticket')
+%p.meta
+ = t("activities.organized_by", name: @activity.creator_name).html_safe
+
+= render "action", activity: @activity, type: @activity.relation_ship_with(current_user), remote: false
+
+%section.overview
+= render "activities/progress", activity: @activity
+%p
+ = @activity.room_left
+- if @activity.participants.any?
+ .participants
+ %h3
+ = t("activities.participants")
+ %ul
+ - ParticipantDecorator.decorate_collection(@activity.participants).each do |participant|
+ %li(title="#{ participant.name }")>
+ = image_tag(participant.avatar_url(48))
+
+%section.description
+.wrapper
+ = @activity.description_markdown
+
+ - unless @activity.requirements_markdown.empty?
+ %h4
+ = t("activities.required")
+ = @activity.requirements_markdown
+
+%section.details
+%dl.wrapper
+ - if @activity.anytime?
+ %dt
+ = t("activities.time_and_date")
+ %dd
+ = t("activities.anytime")
+ - else
+ %dt
+ = t("activities.start.label_short")
+ %dd
+ = l(@activity.start_time, format: :nice_date_and_time)
+ %dt
+ = t("activities.end.label_short")
+ %dd
+ = l(@activity.end_time, format: :nice_date_and_time)
+ %dt
+ = t("activities.location")
+ %dd
+ = @activity.location
+ %br
+ %br
+ %a#show-map= t("activity_form.location.show-map")
+
+#meeting-point-map.meeting-point-map
+ = image_tag 'activities/meeting_points.svg'
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 02176b64..01b20cae 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -1,12 +1,20 @@
!!!
-- html_tag :class => "no-js" do
+- html_tag :lang => 'en' do
%head
- %title= title("Eurucamp Activities")
- = stylesheet_link_tag "application"
- = javascript_include_tag "application"
- = csrf_meta_tags
+ = render "partials/layout_head"
+ = render "partials/preinitializers"
- %body(class=body_class)
+ %body(class="#{ body_class(controller.action_name) }")
= render "partials/chrome_frame"
-
- = yield
+ = render "partials/notifications"
+ = render "partials/header"
+ #main(role="main")
+ %article.page-section.page-section--sub-page
+ .page-section__wrapper
+ .page-section__image
+ = image_tag "activities/activities.svg", class: "page-section__image--vertical"
+ -#= image_tag "activities/activities_mobile.svg", class: "page-section__image--horizontal"
+ .page-section__inner
+ = yield
+ = render "partials/footer"
+ = javascript_include_tag "application"
diff --git a/app/views/layouts/user.html.haml b/app/views/layouts/user.html.haml
new file mode 100644
index 00000000..b63dd10f
--- /dev/null
+++ b/app/views/layouts/user.html.haml
@@ -0,0 +1,17 @@
+!!!
+- html_tag :lang => 'en', :class => "no-js" do
+ %head
+ = render "partials/layout_head"
+ = render "partials/preinitializers"
+
+ %body(class="user #{ body_class(controller.action_name) }")
+ = render "partials/chrome_frame"
+ = render "partials/notifications"
+ #container
+ %header#header
+ = render "partials/navigation"
+
+ #main(role="main")
+ = yield
+ = render "partials/footer"
+ = javascript_include_tag "application"
diff --git a/app/views/partials/_footer.html.haml b/app/views/partials/_footer.html.haml
new file mode 100644
index 00000000..b30afd89
--- /dev/null
+++ b/app/views/partials/_footer.html.haml
@@ -0,0 +1,8 @@
+#footer
+
+ -# cross-site navigation, add correct links
+ %nav
+ %ul
+ %li
+ %a(href="https://isleofruby.org" title="#{t("footer_nav.isleofruby.title")}")
+ = t("footer_nav.isleofruby.label")
diff --git a/app/views/partials/_header.html.haml b/app/views/partials/_header.html.haml
new file mode 100644
index 00000000..66c5b7c7
--- /dev/null
+++ b/app/views/partials/_header.html.haml
@@ -0,0 +1,8 @@
+%header.page-header
+ .page-header__sky
+ .page-header__logo
+%header.page-header-mobile
+ .page-header-mobile-sky
+ .page-header-mobile-logo
+
+ -#= render "partials/navigation"
diff --git a/app/views/partials/_layout_head.html.haml b/app/views/partials/_layout_head.html.haml
new file mode 100644
index 00000000..54dc2760
--- /dev/null
+++ b/app/views/partials/_layout_head.html.haml
@@ -0,0 +1,11 @@
+%meta(charset="utf-8")
+%meta(content="IE=edge,chrome=1" http-equiv="X-UA-Compatible")
+%title= title(Settings.seo.title)
+%meta{content: Settings.seo.description, name: "description"}
+%meta{content: Settings.seo.author, name: "author"}
+%meta(content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" name="viewport")
+
+= csrf_meta_tags
+
+= stylesheet_link_tag "application"
+
diff --git a/app/views/partials/_navigation.html.haml b/app/views/partials/_navigation.html.haml
new file mode 100644
index 00000000..6f6b062a
--- /dev/null
+++ b/app/views/partials/_navigation.html.haml
@@ -0,0 +1,14 @@
+- if devise_controller?
+ = link_to t("user_nav.back_home.label"), root_path, title: t("user_nav.back_home.title"), class: "back-home"
+%nav.user-nav
+ %ul
+ - if current_user
+ %li
+ = link_to t("user_nav.account.label"), edit_user_registration_path, title: t("user_nav.account.title")
+ %li
+ = link_to t("user_nav.logout.label"), destroy_user_session_path, title: t("user_nav.logout.title"), method: "delete"
+ - else
+ %li
+ = link_to t("user_nav.login.label"), new_user_session_path, title: t("user_nav.login.title")
+ %li
+ = link_to t("user_nav.register.label"), new_user_registration_path, title: t("user_nav.register.title")
diff --git a/app/views/partials/_notifications.html.haml b/app/views/partials/_notifications.html.haml
new file mode 100644
index 00000000..93cae0d5
--- /dev/null
+++ b/app/views/partials/_notifications.html.haml
@@ -0,0 +1,4 @@
+#notifications
+ - flash.each do |key, value|
+ %div(class=key)
+ = value
diff --git a/app/views/partials/_preinitializers.html.haml b/app/views/partials/_preinitializers.html.haml
new file mode 100644
index 00000000..3b13dee2
--- /dev/null
+++ b/app/views/partials/_preinitializers.html.haml
@@ -0,0 +1,17 @@
+:javascript
+ try {
+ Typekit.load();
+ } catch(e) {
+ //omnomnom
+ }
+
+ var App = {
+ paths: {
+ login: '#{new_user_session_path}'
+ },
+ event: {
+ name: '#{current_event.name}',
+ startTime: #{current_event.start_time.to_i * 1000},
+ endTime: #{current_event.end_time.to_i * 1000}
+ }
+ };
diff --git a/app/views/participations/create.js.erb b/app/views/participations/create.js.erb
new file mode 100644
index 00000000..56a89284
--- /dev/null
+++ b/app/views/participations/create.js.erb
@@ -0,0 +1,6 @@
+$('#activity-<%= @current_activity.id %>')
+ .replaceWith('<%= escape_javascript(render partial: 'activities/activity', locals: { activity: @current_activity }) %>');
+$('#activity-<%= @current_activity.id %>')
+ .find('.progress')
+ .progress();
+$('#activities-filter .participant strong').text('<%= Activity.participated_by(current_user).count(:all) %>')
diff --git a/app/views/participations/destroy.js.erb b/app/views/participations/destroy.js.erb
new file mode 100644
index 00000000..56a89284
--- /dev/null
+++ b/app/views/participations/destroy.js.erb
@@ -0,0 +1,6 @@
+$('#activity-<%= @current_activity.id %>')
+ .replaceWith('<%= escape_javascript(render partial: 'activities/activity', locals: { activity: @current_activity }) %>');
+$('#activity-<%= @current_activity.id %>')
+ .find('.progress')
+ .progress();
+$('#activities-filter .participant strong').text('<%= Activity.participated_by(current_user).count(:all) %>')
diff --git a/app/views/passwords/new.html.haml b/app/views/passwords/new.html.haml
new file mode 100644
index 00000000..ff8b0975
--- /dev/null
+++ b/app/views/passwords/new.html.haml
@@ -0,0 +1,22 @@
+%article
+ %header
+ %h2
+ Reset your password
+
+ %section.form
+ = form_for resource, as: resource_name, url: password_path(resource_name), method: :post do |f|
+ -#%p Send me reset password instructions to this email address:
+
+ %label.email
+ %span.label Email address
+ = f.email_field :email, placeholder: "You email address"
+
+ %button(type="submit")>
+ Send me instructions
+
+ %p.info
+ = succeed '.' do
+ You can also
+ = link_to new_registration_path(:user), title: "Sign up" do
+ sign up
+ if you don't have account yet.
diff --git a/app/views/registrations/_oauth.html.haml b/app/views/registrations/_oauth.html.haml
new file mode 100644
index 00000000..17db60f6
--- /dev/null
+++ b/app/views/registrations/_oauth.html.haml
@@ -0,0 +1,27 @@
+- domain ||= "new"
+
+.oauth
+ %ul
+ %li
+ - if resource.connected_with_github?
+ = link_to "http://github.com/#{resource.github_handle}", class: "github connected" do
+ = image_tag "user/connected.png"
+ %h4
+ = t("user.#{domain}.oauth.github.connected").html_safe
+ - else
+ = link_to "/auth/github", class: "github" do
+ = image_tag "user/github.png"
+ %h4
+ = t("user.#{domain}.oauth.github.connect").html_safe
+
+ %li
+ - if resource.connected_with_twitter?
+ = link_to "http://twitter.com/#{resource.twitter_handle}", class: "twitter connected" do
+ = image_tag "user/connected.png"
+ %h4
+ = t("user.#{domain}.oauth.twitter.connected").html_safe
+ - else
+ = link_to "/auth/twitter", class: "twitter" do
+ = image_tag "user/twitter.png"
+ %h4
+ = t("user.#{domain}.oauth.twitter.connect").html_safe
diff --git a/app/views/registrations/edit.html.haml b/app/views/registrations/edit.html.haml
new file mode 100644
index 00000000..1920f9ae
--- /dev/null
+++ b/app/views/registrations/edit.html.haml
@@ -0,0 +1,39 @@
+%article
+ %header
+ %h2
+ Edit profile
+
+ %section.form
+ = form_for resource, as: resource_name, url: registration_path(resource_name) do |f|
+
+ %figure.avatar
+ = image_tag(avatar_url(@user, 128))
+
+ %label.name
+ %span.label Your (user) name
+ = f.text_field :name, placeholder: "Your name"
+
+ %label.email
+ %span.label Your email address
+ = f.email_field :email, placeholder: "Your email address"
+
+ %label.inline.show_participation
+ = f.check_box :show_participation
+ Show participations publicly?
+
+ - if resource.no_oauth_connected?
+ %label.password
+ %span.label Your password
+ = f.password_field :password, placeholder: "Your password"
+
+ %label.password
+ %span.label Your password once more
+ = f.password_field :password_confirmation, placeholder: "Your password once more"
+
+ %button(type="submit")>
+ Update
+
+ %p.divider
+ %span Connect!
+
+ = render "oauth", :resource => resource, :domain => "edit"
diff --git a/app/views/registrations/new.html.haml b/app/views/registrations/new.html.haml
new file mode 100644
index 00000000..8afc4a28
--- /dev/null
+++ b/app/views/registrations/new.html.haml
@@ -0,0 +1,44 @@
+%article
+ %header
+ %h2
+ Register
+
+ %section.form
+
+ - unless during_oauth_flow?
+ = render "registrations/oauth", :resource => resource, :domain => "new"
+
+ %p.divider
+ %span or
+
+ = form_for resource, as: resource_name, url: registration_path(resource_name) do |f|
+ %h4= during_oauth_flow? ? "One step more - we need your email address" : "Register a new account"
+
+ %label.name
+ %span.label Name
+ = f.text_field :name, autofocus: true, placeholder: "Name"
+
+ %label.email
+ %span.label Email address
+ = f.email_field :email, placeholder: "Email address"
+
+ - if @user.password_required?
+ %label.password
+ %span.label Password
+ = f.password_field :password, placeholder: "Password"
+
+ %label.password
+ %span.label Password, once more
+ = f.password_field :password_confirmation, placeholder: "Password once more"
+
+ %button(type="submit")>
+ Sign up
+
+ %p.info
+ = succeed '.' do
+ Have an account already?
+ = link_to new_session_path(:user), title: "Sign in" do
+ Sign in
+ or
+ = link_to new_password_path(:user), title: "Reset your password" do
+ reset your password
diff --git a/app/views/sessions/new.html.haml b/app/views/sessions/new.html.haml
new file mode 100644
index 00000000..0cfaff0d
--- /dev/null
+++ b/app/views/sessions/new.html.haml
@@ -0,0 +1,32 @@
+%article
+ %header
+ %h2
+ Sign in
+
+ %section.form
+ = form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
+
+ %label.email
+ %span.label Your email address
+ = f.email_field :email, autofocus: true, placeholder: "Your email address"
+
+ %label.password
+ %span.label Your password
+ = f.password_field :password, placeholder: "Your password"
+
+ %button(type="submit")>
+ Sign in
+
+ %p.divider
+ %span or
+
+ = render "registrations/oauth", :resource => resource
+
+ %p.info
+ = succeed '.' do
+ Otherwise
+ = link_to new_registration_path(:user), title: "Create a new account" do
+ create a new account
+ or
+ = link_to new_password_path(:user), title: "Reset your password" do
+ reset your password
diff --git a/bin/rails b/bin/rails
index 728cd85a..07396602 100755
--- a/bin/rails
+++ b/bin/rails
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
-APP_PATH = File.expand_path('../../config/application', __FILE__)
+APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 00000000..e620b4da
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?('config/database.yml')
+ # cp 'config/database.yml.sample', 'config/database.yml'
+ # end
+
+ puts "\n== Preparing database =="
+ system! 'bin/rails db:setup'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
diff --git a/bin/update b/bin/update
new file mode 100755
index 00000000..a8e4462f
--- /dev/null
+++ b/bin/update
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a way to update your development environment automatically.
+ # Add necessary update steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ puts "\n== Updating database =="
+ system! 'bin/rails db:migrate'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
diff --git a/config/application.rb b/config/application.rb
index c2e0203c..01563e39 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -1,24 +1,15 @@
-require File.expand_path('../boot', __FILE__)
+require_relative 'boot'
require 'rails/all'
-# Assets should be precompiled for production (so we don't need the gems loaded then)
-Bundler.require(*Rails.groups(assets: %w(development test)))
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
module Activities
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
-
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
- # config.time_zone = 'Central Time (US & Canada)'
-
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
- # config.i18n.default_locale = :de
end
end
-
-require Rails.root + "app/models/settings"
diff --git a/config/application.yml b/config/application.yml
index eda6754e..da6a863f 100644
--- a/config/application.yml
+++ b/config/application.yml
@@ -1,20 +1,30 @@
defaults: &defaults
+ event:
+ name: "Isle of Ruby"
+ start_time: 2017-04-11 00:00:00
+ end_time: 2017-04-16 23:59:59
+ host: "activities.isleofruby.org"
mailers:
- from: "activities@eurucamp.org"
+ from: "activities@isleofruby.org"
errors:
- from: "exception@eurucamp.org"
+ from: "exception@isleofruby.org"
to:
- - "piotr@gega.io"
- - "florian@polarblau.com"
+ - "cfp-errors@isleofruby.org"
+ seo:
+ title: "Isle of Ruby"
+ author: "Isle of Ruby team"
+ description: "List of events at and around Isle of Ruby"
development:
<<: *defaults
+ host: "activities.dev:3000"
test:
<<: *defaults
staging:
<<: *defaults
+ host: "TBD"
production:
<<: *defaults
diff --git a/config/boot.rb b/config/boot.rb
index 35967366..30f5120d 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,4 +1,3 @@
-# Set up gems listed in the Gemfile.
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
-require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
+require 'bundler/setup' # Set up gems listed in the Gemfile.
diff --git a/config/cable.yml b/config/cable.yml
new file mode 100644
index 00000000..0bbde6f7
--- /dev/null
+++ b/config/cable.yml
@@ -0,0 +1,9 @@
+development:
+ adapter: async
+
+test:
+ adapter: async
+
+production:
+ adapter: redis
+ url: redis://localhost:6379/1
diff --git a/config/database.yml.sample b/config/database.yml.sample
index e3d84d19..75fd13ca 100644
--- a/config/database.yml.sample
+++ b/config/database.yml.sample
@@ -1,11 +1,11 @@
defaults: &defaults
adapter: postgresql
encoding: utf8
- host: localhost
port: 5432
pool: 5
- username: your_name
- password:
+# host: localhost
+# username: your_name
+# password:
development:
<<: *defaults
diff --git a/config/environment.rb b/config/environment.rb
index c78a58a0..426333bb 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,5 +1,5 @@
-# Load the rails application.
-require File.expand_path('../application', __FILE__)
+# Load the Rails application.
+require_relative 'application'
-# Initialize the rails application.
-Activities::Application.initialize!
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 720958e9..16ae52a7 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,4 +1,4 @@
-Activities::Application.configure do
+Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
@@ -9,19 +9,48 @@
# Do not eager load code on boot.
config.eager_load = false
- # Show full error reports and disable caching.
- config.consider_all_requests_local = true
- config.action_controller.perform_caching = false
+ # Show full error reports.
+ config.consider_all_requests_local = true
+
+ # Enable/disable caching. By default caching is disabled.
+ if Rails.root.join('tmp/caching-dev.txt').exist?
+ config.action_controller.perform_caching = true
+
+ config.cache_store = :memory_store
+ config.public_file_server.headers = {
+ 'Cache-Control' => 'public, max-age=172800'
+ }
+ else
+ config.action_controller.perform_caching = false
+
+ config.cache_store = :null_store
+ end
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.perform_caching = false
+
+ config.action_mailer.default_url_options = { host: Settings.host }
+
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
- # Raise an error on page load if there are pending migrations
+ # Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
+ # This option may cause significant delays in view rendering with a large
+ # number of complex assets.
config.assets.debug = true
+
+ # Suppress logger output for asset requests.
+ config.assets.quiet = true
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
+
+ # Use an evented file watcher to asynchronously detect changes in source code,
+ # routes, locales, etc. This feature depends on the listen gem.
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index de3d247e..ff29a518 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -1,11 +1,11 @@
-Activities::Application.configure do
+Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
- # your application in memory, allowing both thread web servers
+ # your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
@@ -14,72 +14,81 @@
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
- # Add `rack-cache` to your Gemfile before enabling this.
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
- # config.action_dispatch.rack_cache = true
-
- # Disable Rails's static asset server (Apache or nginx will already do this).
- config.serve_static_assets = false
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
- config.assets.js_compressor = :uglifier
+ config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
- # Whether to fallback to assets pipeline if a precompiled asset is missed.
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
- # Generate digests for assets URLs.
- config.assets.digest = true
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
- # Version of your assets, change this if you want to expire all your assets.
- config.assets.version = '1.0'
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.action_controller.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files.
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
+
+ # Mount Action Cable outside main process or domain
+ # config.action_cable.mount_path = nil
+ # config.action_cable.url = 'wss://example.com/cable'
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
- # config.force_ssl = true
+ config.force_ssl = true
- # Set to :debug to see everything in the log.
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
config.log_level = :info
# Prepend all log lines with the following tags.
- # config.log_tags = [ :subdomain, :uuid ]
-
- # Use a different logger for distributed setups.
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
+ config.log_tags = [:request_id]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
- # config.action_controller.asset_host = "http://assets.example.com"
-
- # Precompile additional assets.
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
- # config.assets.precompile += %w( search.js )
+ # Use a real queuing backend for Active Job (and separate queues per environment)
+ # config.active_job.queue_adapter = :resque
+ # config.active_job.queue_name_prefix = "activities_#{Rails.env}"
+ config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.delivery_method = :sendmail
+ config.action_mailer.default_url_options = { host: Settings.host }
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
- # the I18n.default_locale when a translation can not be found).
+ # the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
- # Disable automatic flushing of the log to improve performance.
- # config.autoflush_log = false
-
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
- config.middleware.use ExceptionNotifier,
- :email_prefix => "[Eurucamp-activities::Exception] ",
- :sender_address => %{"Exception Notifier" <#{Settings.errors.from}>},
- :exception_recipients => Settings.errors.to
+ # Use a different logger for distributed setups.
+ # require 'syslog/logger'
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
+
+ if ENV['RAILS_LOG_TO_STDOUT'].present?
+ logger = ActiveSupport::Logger.new(STDOUT)
+ logger.formatter = config.log_formatter
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
+ end
+
+ config.middleware.use ExceptionNotification::Rack, email: {
+ email_prefix: '[isleofruby-activities::Exception] ',
+ sender_address: %("Exception Notifier" <#{Settings.errors.from}>),
+ exception_recipients: Settings.errors.to
+ }
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
end
diff --git a/config/environments/staging.rb b/config/environments/staging.rb
index 5b50a485..4c9aa3ec 100644
--- a/config/environments/staging.rb
+++ b/config/environments/staging.rb
@@ -1,10 +1,11 @@
-Activities::Application.configure do
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
- # your application in memory, allowing both thread web servers
+ # your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
@@ -13,74 +14,81 @@
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
- # Add `rack-cache` to your Gemfile before enabling this.
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
- # config.action_dispatch.rack_cache = true
-
- # Disable Rails's static asset server (Apache or nginx will already do this).
- config.serve_static_assets = false
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
- config.assets.js_compressor = :uglifier
+ config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
- # Whether to fallback to assets pipeline if a precompiled asset is missed.
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
- # Generate digests for assets URLs.
- config.assets.digest = true
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
- # Version of your assets, change this if you want to expire all your assets.
- config.assets.version = '1.0'
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.action_controller.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files.
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
+
+ # Mount Action Cable outside main process or domain
+ # config.action_cable.mount_path = nil
+ # config.action_cable.url = 'wss://example.com/cable'
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
- # config.force_ssl = true
+ config.force_ssl = true
- # Set to :debug to see everything in the log.
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
config.log_level = :info
# Prepend all log lines with the following tags.
- # config.log_tags = [ :subdomain, :uuid ]
-
- # Use a different logger for distributed setups.
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
+ config.log_tags = [:request_id]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
- # config.action_controller.asset_host = "http://assets.example.com"
-
- # Precompile additional assets.
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
- # config.assets.precompile += %w( search.js )
+ # Use a real queuing backend for Active Job (and separate queues per environment)
+ # config.active_job.queue_adapter = :resque
+ # config.active_job.queue_name_prefix = "activities_#{Rails.env}"
+ config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
+ config.action_mailer.delivery_method = :sendmail
+ config.action_mailer.default_url_options = { host: Settings.host }
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
- # the I18n.default_locale when a translation can not be found).
+ # the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
- # Disable automatic flushing of the log to improve performance.
- # config.autoflush_log = false
-
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
- config.middleware.insert_before(::ActionDispatch::Static, ::Rack::Robotz, "User-Agent" => "*", "Disallow" => "/")
-
- config.middleware.use ExceptionNotifier,
- :email_prefix => "[Eurucamp-activities-staging::Exception] ",
- :sender_address => %{"Exception Notifier" <#{Settings.errors.from}>},
- :exception_recipients => Settings.errors.to
+ # Use a different logger for distributed setups.
+ # require 'syslog/logger'
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
+
+ if ENV['RAILS_LOG_TO_STDOUT'].present?
+ logger = ActiveSupport::Logger.new(STDOUT)
+ logger.formatter = config.log_formatter
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
+ end
+
+ config.middleware.use ExceptionNotification::Rack, email: {
+ email_prefix: '[isleofruby-activities-staging::Exception] ',
+ sender_address: %("Exception Notifier" <#{Settings.errors.from}>),
+ exception_recipients: Settings.errors.to
+ }
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 1f27b3c6..7cb43f84 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,4 +1,4 @@
-Activities::Application.configure do
+Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
@@ -12,9 +12,11 @@
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
- # Configure static asset server for tests with Cache-Control for performance.
- config.serve_static_assets = true
- config.static_cache_control = "public, max-age=3600"
+ # Configure public file server for tests with Cache-Control for performance.
+ config.public_file_server.enabled = true
+ config.public_file_server.headers = {
+ 'Cache-Control' => 'public, max-age=3600'
+ }
# Show full error reports and disable caching.
config.consider_all_requests_local = true
@@ -25,12 +27,17 @@
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
+ config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
+ config.action_mailer.default_url_options = { host: Settings.host }
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
end
diff --git a/config/heroku.yml b/config/heroku.yml
deleted file mode 100644
index 7301b204..00000000
--- a/config/heroku.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-production:
- stack: cedar
- app: eurucamp-activities-2013
- config:
- BUNDLE_WITHOUT: "development:test"
-
-staging:
- stack: cedar
- app: eurucamp-activities-2013-dev
- config: &default
- BUNDLE_WITHOUT: "development:test"
diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb
new file mode 100644
index 00000000..51639b67
--- /dev/null
+++ b/config/initializers/application_controller_renderer.rb
@@ -0,0 +1,6 @@
+# Be sure to restart your server when you modify this file.
+
+# ApplicationController.renderer.defaults.merge!(
+# http_host: 'example.org',
+# https: false
+# )
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
new file mode 100644
index 00000000..01ef3e66
--- /dev/null
+++ b/config/initializers/assets.rb
@@ -0,0 +1,11 @@
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = '1.0'
+
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
+# Rails.application.config.assets.precompile += %w( search.js )
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
new file mode 100644
index 00000000..5a6a32d3
--- /dev/null
+++ b/config/initializers/cookies_serializer.rb
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Specify a serializer for the signed and encrypted cookie jars.
+# Valid options are :json, :marshal, and :hybrid.
+Rails.application.config.action_dispatch.cookies_serializer = :json
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
new file mode 100644
index 00000000..b2f33ecf
--- /dev/null
+++ b/config/initializers/devise.rb
@@ -0,0 +1,275 @@
+# Use this hook to configure devise mailer, warden hooks and so forth.
+# Many of these configuration options can be set straight in your model.
+Devise.setup do |config|
+ # The secret key used by Devise. Devise uses this key to generate
+ # random tokens. Changing this key will render invalid all existing
+ # confirmation, reset password and unlock tokens in the database.
+ # Devise will use the `secret_key_base` as its `secret_key`
+ # by default. You can change it below and use your own secret key.
+ # config.secret_key = '99cc8d08d0de127049cddd1b558aeff34974fb980754b7e46d0d1ab742b067ba56317ff666fd8c1792d4d4e3c858cd28a2965570ab85e4057097e4270a62eb8a'
+
+ # ==> Mailer Configuration
+ # Configure the e-mail address which will be shown in Devise::Mailer,
+ # note that it will be overwritten if you use your own mailer class
+ # with default "from" parameter.
+ config.mailer_sender = Settings.mailers.from
+
+ # Configure the class responsible to send e-mails.
+ # config.mailer = 'Devise::Mailer'
+
+ # Configure the parent class responsible to send e-mails.
+ # config.parent_mailer = 'ActionMailer::Base'
+
+ # ==> ORM configuration
+ # Load and configure the ORM. Supports :active_record (default) and
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
+ # available as additional gems.
+ require 'devise/orm/active_record'
+
+ # ==> Configuration for any authentication mechanism
+ # Configure which keys are used when authenticating a user. The default is
+ # just :email. You can configure it to use [:username, :subdomain], so for
+ # authenticating a user, both parameters are required. Remember that those
+ # parameters are used only when authenticating and not when retrieving from
+ # session. If you need permissions, you should implement that in a before filter.
+ # You can also supply a hash where the value is a boolean determining whether
+ # or not authentication should be aborted when the value is not present.
+ # config.authentication_keys = [:email]
+
+ # Configure parameters from the request object used for authentication. Each entry
+ # given should be a request method and it will automatically be passed to the
+ # find_for_authentication method and considered in your model lookup. For instance,
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
+ # config.request_keys = []
+
+ # Configure which authentication keys should be case-insensitive.
+ # These keys will be downcased upon creating or modifying a user and when used
+ # to authenticate or find a user. Default is :email.
+ config.case_insensitive_keys = [:email]
+
+ # Configure which authentication keys should have whitespace stripped.
+ # These keys will have whitespace before and after removed upon creating or
+ # modifying a user and when used to authenticate or find a user. Default is :email.
+ config.strip_whitespace_keys = [:email]
+
+ # Tell if authentication through request.params is enabled. True by default.
+ # It can be set to an array that will enable params authentication only for the
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
+ # enable it only for database (email + password) authentication.
+ # config.params_authenticatable = true
+
+ # Tell if authentication through HTTP Auth is enabled. False by default.
+ # It can be set to an array that will enable http authentication only for the
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
+ # enable it only for database authentication. The supported strategies are:
+ # :database = Support basic authentication with authentication key + password
+ # config.http_authenticatable = false
+
+ # If 401 status code should be returned for AJAX requests. True by default.
+ # config.http_authenticatable_on_xhr = true
+
+ # The realm used in Http Basic Authentication. 'Application' by default.
+ # config.http_authentication_realm = 'Application'
+
+ # It will change confirmation, password recovery and other workflows
+ # to behave the same regardless if the e-mail provided was right or wrong.
+ # Does not affect registerable.
+ # config.paranoid = true
+
+ # By default Devise will store the user in session. You can skip storage for
+ # particular strategies by setting this option.
+ # Notice that if you are skipping storage for all authentication paths, you
+ # may want to disable generating routes to Devise's sessions controller by
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
+ config.skip_session_storage = [:http_auth]
+
+ # By default, Devise cleans up the CSRF token on authentication to
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
+ # requests for sign in and sign up, you need to get a new CSRF token
+ # from the server. You can disable this option at your own risk.
+ # config.clean_up_csrf_token_on_authentication = true
+
+ # When false, Devise will not attempt to reload routes on eager load.
+ # This can reduce the time taken to boot the app but if your application
+ # requires the Devise mappings to be loaded during boot time the application
+ # won't boot properly.
+ # config.reload_routes = true
+
+ # ==> Configuration for :database_authenticatable
+ # For bcrypt, this is the cost for hashing the password and defaults to 11. If
+ # using other algorithms, it sets how many times you want the password to be hashed.
+ #
+ # Limiting the stretches to just one in testing will increase the performance of
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
+ config.stretches = Rails.env.test? ? 1 : 11
+
+ # Set up a pepper to generate the hashed password.
+ # config.pepper = '2fb8ef4e815cfcbb05feec0a622ec011fe47bffcb5b36631bcfc81d47a77a62850e6055b3b41fc4c2c9a332c0e6fc58a315635eccddad5f8170569b877e28e44'
+
+ # Send a notification email when the user's password is changed
+ # config.send_password_change_notification = false
+
+ # ==> Configuration for :confirmable
+ # A period that the user is allowed to access the website even without
+ # confirming their account. For instance, if set to 2.days, the user will be
+ # able to access the website for two days without confirming their account,
+ # access will be blocked just in the third day. Default is 0.days, meaning
+ # the user cannot access the website without confirming their account.
+ # config.allow_unconfirmed_access_for = 2.days
+
+ # A period that the user is allowed to confirm their account before their
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
+ # their account within 3 days after the mail was sent, but on the fourth day
+ # their account can't be confirmed with the token any more.
+ # Default is nil, meaning there is no restriction on how long a user can take
+ # before confirming their account.
+ # config.confirm_within = 3.days
+
+ # If true, requires any email changes to be confirmed (exactly the same way as
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
+ # db field (see migrations). Until confirmed, new email is stored in
+ # unconfirmed_email column, and copied to email column on successful confirmation.
+ config.reconfirmable = true
+
+ # Defines which key will be used when confirming an account
+ # config.confirmation_keys = [:email]
+
+ # ==> Configuration for :rememberable
+ # The time the user will be remembered without asking for credentials again.
+ # config.remember_for = 2.weeks
+
+ # Invalidates all the remember me tokens when the user signs out.
+ config.expire_all_remember_me_on_sign_out = true
+
+ # If true, extends the user's remember period when remembered via cookie.
+ # config.extend_remember_period = false
+
+ # Options to be passed to the created cookie. For instance, you can set
+ # secure: true in order to force SSL only cookies.
+ # config.rememberable_options = {}
+
+ # ==> Configuration for :validatable
+ # Range for password length.
+ config.password_length = 8..128
+
+ # Email regex used to validate email formats. It simply asserts that
+ # one (and only one) @ exists in the given string. This is mainly
+ # to give user feedback and not to assert the e-mail validity.
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
+
+ # ==> Configuration for :timeoutable
+ # The time you want to timeout the user session without activity. After this
+ # time the user will be asked for credentials again. Default is 30 minutes.
+ # config.timeout_in = 30.minutes
+
+ # ==> Configuration for :lockable
+ # Defines which strategy will be used to lock an account.
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
+ # :none = No lock strategy. You should handle locking by yourself.
+ # config.lock_strategy = :failed_attempts
+
+ # Defines which key will be used when locking and unlocking an account
+ # config.unlock_keys = [:email]
+
+ # Defines which strategy will be used to unlock an account.
+ # :email = Sends an unlock link to the user email
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
+ # :both = Enables both strategies
+ # :none = No unlock strategy. You should handle unlocking by yourself.
+ # config.unlock_strategy = :both
+
+ # Number of authentication tries before locking an account if lock_strategy
+ # is failed attempts.
+ # config.maximum_attempts = 20
+
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
+ # config.unlock_in = 1.hour
+
+ # Warn on the last attempt before the account is locked.
+ # config.last_attempt_warning = true
+
+ # ==> Configuration for :recoverable
+ #
+ # Defines which key will be used when recovering the password for an account
+ # config.reset_password_keys = [:email]
+
+ # Time interval you can reset your password with a reset password key.
+ # Don't put a too small interval or your users won't have the time to
+ # change their passwords.
+ config.reset_password_within = 6.hours
+
+ # When set to false, does not sign a user in automatically after their password is
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
+ # config.sign_in_after_reset_password = true
+
+ # ==> Configuration for :encryptable
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
+ # for default behavior) and :restful_authentication_sha1 (then you should set
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
+ #
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
+ # config.encryptor = :sha512
+
+ # ==> Scopes configuration
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
+ # "users/sessions/new". It's turned off by default because it's slower if you
+ # are using only default views.
+ # config.scoped_views = false
+
+ # Configure the default scope given to Warden. By default it's the first
+ # devise role declared in your routes (usually :user).
+ # config.default_scope = :user
+
+ # Set this configuration to false if you want /users/sign_out to sign out
+ # only the current scope. By default, Devise signs out all scopes.
+ # config.sign_out_all_scopes = true
+
+ # ==> Navigation configuration
+ # Lists the formats that should be treated as navigational. Formats like
+ # :html, should redirect to the sign in page when the user does not have
+ # access, but formats like :xml or :json, should return 401.
+ #
+ # If you have any extra navigational formats, like :iphone or :mobile, you
+ # should add them to the navigational formats lists.
+ #
+ # The "*/*" below is required to match Internet Explorer requests.
+ # config.navigational_formats = ['*/*', :html]
+
+ # The default HTTP method used to sign out a resource. Default is :delete.
+ config.sign_out_via = :delete
+
+ # ==> OmniAuth
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
+ # up on your models and hooks.
+ # config.omniauth :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
+ # config.omniauth :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], scope: 'user:email'
+
+ # ==> Warden configuration
+ # If you want to use other strategies, that are not supported by Devise, or
+ # change the failure app, you can configure them inside the config.warden block.
+ #
+ # config.warden do |manager|
+ # manager.intercept_401 = false
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
+ # end
+
+ # ==> Mountable engine configurations
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
+ # is mountable, there are some extra configurations to be taken into account.
+ # The following options are available, assuming the engine is mounted as:
+ #
+ # mount MyEngine, at: '/my_engine'
+ #
+ # The router that invoked `devise_for`, in the example above, would be:
+ # config.router_name = :my_engine
+ #
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
+ # so you need to do it manually. For the users scope, it would be:
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
+end
diff --git a/config/initializers/haml.rb b/config/initializers/haml.rb
new file mode 100644
index 00000000..7e8ddb37
--- /dev/null
+++ b/config/initializers/haml.rb
@@ -0,0 +1 @@
+Haml::Template.options[:ugly] = true
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
index 72aca7e4..dc189968 100644
--- a/config/initializers/mime_types.rb
+++ b/config/initializers/mime_types.rb
@@ -2,4 +2,3 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
-# Mime::Type.register_alias "text/html", :iphone
diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb
new file mode 100644
index 00000000..4415dc3f
--- /dev/null
+++ b/config/initializers/new_framework_defaults.rb
@@ -0,0 +1,23 @@
+# Be sure to restart your server when you modify this file.
+#
+# This file contains migration options to ease your Rails 5.0 upgrade.
+#
+# Once upgraded flip defaults one by one to migrate to the new default.
+#
+# Read the Guide for Upgrading Ruby on Rails for more info on each option.
+
+# Enable per-form CSRF tokens. Previous versions had false.
+Rails.application.config.action_controller.per_form_csrf_tokens = false
+
+# Enable origin-checking CSRF mitigation. Previous versions had false.
+Rails.application.config.action_controller.forgery_protection_origin_check = false
+
+# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
+# Previous versions had false.
+ActiveSupport.to_time_preserves_timezone = false
+
+# Require `belongs_to` associations by default. Previous versions had false.
+Rails.application.config.active_record.belongs_to_required_by_default = false
+
+# Do not halt callback chains when a callback returns false. Previous versions had true.
+ActiveSupport.halt_callback_chains_on_return_false = true
diff --git a/config/initializers/omni_auth.rb b/config/initializers/omni_auth.rb
new file mode 100644
index 00000000..e0dd9da3
--- /dev/null
+++ b/config/initializers/omni_auth.rb
@@ -0,0 +1,4 @@
+Rails.application.config.middleware.use OmniAuth::Builder do
+ provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
+ provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], scope: 'user:email'
+end
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 034b4039..ba0a3f43 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file.
-Activities::Application.config.session_store :encrypted_cookie_store, key: '_activities_session'
+Rails.application.config.session_store :cookie_store, key: '_activities_session'
diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb
new file mode 100644
index 00000000..0b29ab76
--- /dev/null
+++ b/config/initializers/simple_form.rb
@@ -0,0 +1,144 @@
+# Use this setup block to configure all options available in SimpleForm.
+SimpleForm.setup do |config|
+ # Wrappers are used by the form builder to generate a
+ # complete input. You can remove any component from the
+ # wrapper, change the order or even add your own to the
+ # stack. The options given below are used to wrap the
+ # whole input.
+ config.wrappers :default, :class => :input,
+ :hint_class => :field_with_hint, :error_class => :field_with_errors do |b|
+ ## Extensions enabled by default
+ # Any of these extensions can be disabled for a
+ # given input by passing: `f.input EXTENSION_NAME => false`.
+ # You can make any of these extensions optional by
+ # renaming `b.use` to `b.optional`.
+
+ # Determines whether to use HTML5 (:email, :url, ...)
+ # and required attributes
+ b.use :html5
+
+ # Calculates placeholders automatically from I18n
+ # You can also pass a string as f.input :placeholder => "Placeholder"
+ b.use :placeholder
+
+ ## Optional extensions
+ # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
+ # to the input. If so, they will retrieve the values from the model
+ # if any exists. If you want to enable the lookup for any of those
+ # extensions by default, you can change `b.optional` to `b.use`.
+
+ # Calculates maxlength from length validations for string inputs
+ b.optional :maxlength
+
+ # Calculates pattern from format validations for string inputs
+ b.optional :pattern
+
+ # Calculates min and max from length validations for numeric inputs
+ b.optional :min_max
+
+ # Calculates readonly automatically from readonly attributes
+ b.optional :readonly
+
+ ## Inputs
+ b.use :label_input
+ b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
+ b.use :error, :wrap_with => { :tag => :span, :class => :error }
+ end
+
+ # The default wrapper to be used by the FormBuilder.
+ config.default_wrapper = :default
+
+ # Define the way to render check boxes / radio buttons with labels.
+ # Defaults to :nested for bootstrap config.
+ # :inline => input + label
+ # :nested => label > input
+ config.boolean_style = :nested
+
+ # Default class for buttons
+ config.button_class = 'btn'
+
+ # Method used to tidy up errors. Specify any Rails Array method.
+ # :first lists the first message for each field.
+ # Use :to_sentence to list all errors for each field.
+ # config.error_method = :first
+
+ # Default tag used for error notification helper.
+ config.error_notification_tag = :div
+
+ # CSS class to add for error notification helper.
+ config.error_notification_class = 'alert alert-error'
+
+ # ID to add for error notification helper.
+ # config.error_notification_id = nil
+
+ # Series of attempts to detect a default label method for collection.
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
+
+ # Series of attempts to detect a default value method for collection.
+ # config.collection_value_methods = [ :id, :to_s ]
+
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
+ # config.collection_wrapper_tag = nil
+
+ # You can define the class to use on all collection wrappers. Defaulting to none.
+ # config.collection_wrapper_class = nil
+
+ # You can wrap each item in a collection of radio/check boxes with a tag,
+ # defaulting to :span. Please note that when using :boolean_style = :nested,
+ # SimpleForm will force this option to be a label.
+ # config.item_wrapper_tag = :span
+
+ # You can define a class to use in all item wrappers. Defaulting to none.
+ # config.item_wrapper_class = nil
+
+ # How the label text should be generated altogether with the required text.
+ config.label_text = lambda { |label, required|
+ required.empty? ? "#{label}" : "#{label}"
+ }
+
+ # You can define the class to use on all labels. Default is nil.
+ config.label_class = 'control-label'
+
+ # You can define the class to use on all forms. Default is simple_form.
+ # config.form_class = :simple_form
+
+ # You can define which elements should obtain additional classes
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
+
+ # Whether attributes are required by default (or not). Default is true.
+ # config.required_by_default = true
+
+ # Tell browsers whether to use default HTML5 validations (novalidate option).
+ # Default is enabled.
+ config.browser_validations = false
+
+ # Collection of methods to detect if a file type was given.
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
+
+ # Custom mappings for input types. This should be a hash containing a regexp
+ # to match as key, and the input type that will be used when the field name
+ # matches the regexp as value.
+ # config.input_mappings = { /count/ => :integer }
+
+ # Custom wrappers for input types. This should be a hash containing an input
+ # type as key and the wrapper that will be used for all inputs with specified type.
+ # config.wrapper_mappings = { :string => :prepend }
+
+ # Default priority for time_zone inputs.
+ # config.time_zone_priority = nil
+
+ # Default priority for country inputs.
+ # config.country_priority = nil
+
+ # Default size for text inputs.
+ # config.default_input_size = 50
+
+ # When false, do not use translations for labels.
+ # config.translate_labels = true
+
+ # Automatically discover new inputs in Rails' autoload path.
+ # config.inputs_discovery = true
+
+ # Cache SimpleForm inputs discovery
+ # config.cache_discovery = !Rails.env.development?
+end
diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb
new file mode 100644
index 00000000..14a8c2a7
--- /dev/null
+++ b/config/initializers/simple_form_bootstrap.rb
@@ -0,0 +1,45 @@
+# Use this setup block to configure all options available in SimpleForm.
+SimpleForm.setup do |config|
+ config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.use :label
+ b.wrapper :tag => 'div', :class => 'controls' do |ba|
+ ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
+ ba.use :input
+ ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
+ end
+ end
+
+ config.wrappers :prepend, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.use :label
+ b.wrapper :tag => 'div', :class => 'controls' do |input|
+ input.wrapper :tag => 'div', :class => 'input-prepend' do |prepend|
+ prepend.use :input
+ end
+ input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
+ input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
+ end
+ end
+
+ config.wrappers :append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
+ b.use :html5
+ b.use :placeholder
+ b.use :label
+ b.wrapper :tag => 'div', :class => 'controls' do |input|
+ input.wrapper :tag => 'div', :class => 'input-append' do |append|
+ append.use :input
+ end
+ input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
+ input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' }
+ end
+ end
+
+ # Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
+ # Check the Bootstrap docs (http://twitter.github.com/bootstrap)
+ # to learn about the different styles for forms and inputs,
+ # buttons and other elements.
+ config.default_wrapper = :bootstrap
+end
diff --git a/config/initializers/strong_parameters.rb b/config/initializers/strong_parameters.rb
new file mode 100644
index 00000000..394c1f5f
--- /dev/null
+++ b/config/initializers/strong_parameters.rb
@@ -0,0 +1 @@
+ActiveRecord::Base.send(:include, ActiveModel::ForbiddenAttributesProtection)
diff --git a/config/initializers/validation_error.rb b/config/initializers/validation_error.rb
new file mode 100644
index 00000000..97cb9ce9
--- /dev/null
+++ b/config/initializers/validation_error.rb
@@ -0,0 +1,26 @@
+# Overrides Rails' default handling of validation and other
+# error messages for objects.
+# Instead of displaying all errors as list above the form
+# the errors are now displayed after each individual input
+# element wrapped in a ''
+ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
+ error_class = "validation-error"
+ error_message_class = "validation-error-message"
+
+ if html_tag =~ /<(input|textarea|select)[^>]+class=/
+ style_attribute = html_tag =~ /class=['"]/
+ html_tag.insert(style_attribute + 7, "#{error_class} ")
+ elsif html_tag =~ /<(input|textarea|select)/
+ first_whitespace = html_tag =~ /\s/
+ html_tag[first_whitespace] = " class='#{error_class}' "
+ end
+
+ if html_tag =~ /<(label)/
+ html_tag
+ elsif instance.error_message.kind_of?(Array)
+ %(#{html_tag} #{instance.error_message.first}).html_safe
+ else
+ %(#{html_tag} #{instance.error_message}).html_safe
+ end
+
+end
diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb
index 33725e95..bbfc3961 100644
--- a/config/initializers/wrap_parameters.rb
+++ b/config/initializers/wrap_parameters.rb
@@ -5,10 +5,10 @@
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
- wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
+ wrap_parameters format: [:json]
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
-# self.include_root_in_json = true
+# self.include_root_in_json = true
# end
diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml
new file mode 100644
index 00000000..d01f375c
--- /dev/null
+++ b/config/locales/devise.en.yml
@@ -0,0 +1,59 @@
+# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
+
+en:
+ devise:
+ confirmations:
+ confirmed: "Your account was successfully confirmed. You are now signed in."
+ send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
+ failure:
+ already_authenticated: "You are already signed in."
+ inactive: "Your account was not activated yet."
+ invalid: "Invalid email or password."
+ invalid_token: "Invalid authentication token."
+ locked: "Your account is locked."
+ not_found_in_database: "Invalid email or password."
+ timeout: "Your session expired, please sign in again to continue."
+ unauthenticated: "You need to sign in or sign up before continuing."
+ unconfirmed: "You have to confirm your account before continuing."
+ mailer:
+ confirmation_instructions:
+ subject: "Confirmation instructions"
+ reset_password_instructions:
+ subject: "Reset password instructions"
+ unlock_instructions:
+ subject: "Unlock Instructions"
+ omniauth_callbacks:
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
+ success: "Successfully authenticated from %{kind} account."
+ passwords:
+ 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."
+ send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
+ 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."
+ updated: "Your password was changed successfully. You are now signed in."
+ updated_not_active: "Your password was changed successfully."
+ registrations:
+ destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
+ signed_up: "Welcome! You have signed up successfully."
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
+ updated: "You updated your account successfully."
+ sessions:
+ signed_in: "Signed in successfully."
+ signed_out: "Signed out successfully."
+ unlocks:
+ send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
+ errors:
+ messages:
+ already_confirmed: "was already confirmed, please try signing in"
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
+ expired: "has expired, please request a new one"
+ not_found: "not found"
+ not_locked: "was not locked"
+ not_saved:
+ one: "1 error prohibited this %{resource} from being saved:"
+ other: "%{count} errors prohibited this %{resource} from being saved:"
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 06539571..10383b2e 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1,23 +1,158 @@
-# Files in the config/locales directory are used for internationalization
-# and are automatically loaded by Rails. If you want to use locales other
-# than English, add the necessary files in this directory.
-#
-# To use the locales, use `I18n.t`:
-#
-# I18n.t 'hello'
-#
-# In views, this is aliased to just `t`:
-#
-# <%= t('hello') %>
-#
-# To use a different locale, set it with `I18n.locale`:
-#
-# I18n.locale = :es
-#
-# This would use the information in config/locales/es.yml.
-#
-# To learn more, please read the Rails Internationalization guide
-# available at http://guides.rubyonrails.org/i18n.html.
-
en:
- hello: "Hello world"
+ time:
+ formats:
+ time_only: "%H:%M"
+ date_only: "%d-%m-%Y"
+ nice_time: "%H:%M"
+ nice_date: "%a, %-d.%-m"
+ nice_date_and_time: "%a, %-d.%-m — %H:%M"
+
+ common:
+ or: Or
+ submit:
+ new: Save
+ edit: Update
+
+ user_nav:
+ back_home:
+ label: Back to Isle of Ruby activities
+ title: Go back to front page
+ account:
+ label: My Account
+ title: Edit your account details
+ login:
+ label: Login
+ title: Login into app!
+ logout:
+ label: Logout
+ title: Leave now
+ register:
+ label: Register
+ title: Register new account
+
+ user:
+ edit:
+ oauth:
+ github:
+ connect: "Connect your Github account"
+ connected: "You have connected your Github account"
+ twitter:
+ connect: "Connect your Twitter account"
+ connected: "You have connected your Twitter account"
+ new:
+ oauth:
+ github:
+ connect: "Sign in with your Github account"
+ twitter:
+ connect: "Sign in with your Twitter account"
+
+ # index and shared translations
+ activities:
+ filters:
+ today: Today
+ all: All
+ owner: Created by me
+ participant: My activities
+ submit: Filter
+ new:
+ label: Create an activity
+ title: Create a new activity
+ search:
+ placeholder: Search for an activity
+ clear: Clear
+ join:
+ label: Join
+ title: Sign-up as participant
+ edit:
+ label: Edit
+ title: Edit the activity details
+ leave:
+ label: Cancel
+ title: Cancel your participation
+ more_info:
+ label: More info
+ label_long: View activity details
+ title: Learn more about this activity
+ anytime: Anytime
+ time_and_date: "Time & Date"
+ start:
+ label_short: Start
+ end:
+ label_short: End
+ location: Location
+ required: Required
+ requires_eurucamp_ticket: "During the Isle of Ruby participants need a ticket"
+ participants: Participants
+ organized_by: "Organized by %{name}"
+ room_left:
+ none: Sorry. All places are gone.
+ one: "Quick, only one place left."
+ many: "Still room for %{left} people"
+ errors:
+ start_time:
+ too_early: "outside range, too early"
+ end_time:
+ before_start: "can't be before start time"
+ too_late: "outside range, too late"
+ image_url:
+ invalid: "not valid URL"
+ not_supported_protocol: "protocol not supported ;)"
+ danger_zone: Danger Zone
+
+ new_activity:
+ title: Organize an activity
+ notice: Your activity has been created!
+ error: Activity could not be saved. Please check your input.
+
+ edit_activity:
+ title: Edit your activity
+ notice: Your activity has been updated!
+ error: Your changes could not be saved. Please check your input.
+
+ destroy_activity:
+ notice: Your activity has been deleted!
+ error: Your activity could not be deleted. Did you check the confirmation?
+
+ activity_form:
+ markdown_hint: You can use Markdown here
+ name:
+ label: Give your activity a name
+ description:
+ label: Description
+ hint: "Background information, links, etc."
+ anytime:
+ hint: Without a specific date/time
+ location:
+ label: Location
+ hint: "Where does your activity take place, where to meet, …"
+ show-map: 'Show meeting point map'
+ limit_of_participants:
+ hint: Max. participants
+ requirements:
+ label: Requirements
+ hint: "What to bring, to wear etc."
+ requires_eurucamp_ticket:
+ hint: "During the Isle of Ruby participants need a ticket"
+ image_url:
+ label: URL for an image
+ hint: Upload an image to e.g. imgur.com and link it here
+
+ delete_activity_form:
+ title:
+ Delete activity
+ confirmation:
+ one: Really delete this activity (with currently one participant)
+ other: Really delete this activity (with currently %{count} participants)
+ submit:
+ Delete activity
+
+ footer_nav:
+ about:
+ label: About
+ title: What is this all about?
+ policy:
+ label: Policy
+ title: Policy and Code of Conduct
+ isleofruby:
+ label: Isle of Ruby
+ title: Head over to Isle of Ruby site
diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml
new file mode 100644
index 00000000..0df11fe0
--- /dev/null
+++ b/config/locales/simple_form.en.yml
@@ -0,0 +1,26 @@
+en:
+ simple_form:
+ "yes": 'Yes'
+ "no": 'No'
+ required:
+ text: 'required'
+ mark: '*'
+ # You can uncomment the line below if you need to overwrite the whole required html.
+ # When using html, text and mark won't be used.
+ # html: '*'
+ error_notification:
+ default_message: "Please review the problems below:"
+ # Labels and hints examples
+ # labels:
+ # defaults:
+ # password: 'Password'
+ # user:
+ # new:
+ # email: 'E-mail to sign in.'
+ # edit:
+ # email: 'E-mail.'
+ # hints:
+ # defaults:
+ # username: 'User name to sign in.'
+ # password: 'No special characters, please.'
+
diff --git a/config/puma.rb b/config/puma.rb
new file mode 100644
index 00000000..786af492
--- /dev/null
+++ b/config/puma.rb
@@ -0,0 +1,47 @@
+# Puma can serve each request in a thread from an internal thread pool.
+# The `threads` method setting takes two numbers a minimum and maximum.
+# Any libraries that use thread pools should be configured to match
+# the maximum value specified for Puma. Default is set to 5 threads for minimum
+# and maximum, this matches the default thread size of Active Record.
+#
+threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }.to_i
+threads threads_count, threads_count
+
+# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
+#
+port ENV.fetch('PORT') { 3000 }
+
+# Specifies the `environment` that Puma will run in.
+#
+environment ENV.fetch('RAILS_ENV') { 'development' }
+
+# Specifies the number of `workers` to boot in clustered mode.
+# Workers are forked webserver processes. If using threads and workers together
+# the concurrency of the application would be max `threads` * `workers`.
+# Workers do not work on JRuby or Windows (both of which do not support
+# processes).
+#
+# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
+
+# Use the `preload_app!` method when specifying a `workers` number.
+# This directive tells Puma to first boot the application and load code
+# before forking the application. This takes advantage of Copy On Write
+# process behavior so workers use less memory. If you use this option
+# you need to make sure to reconnect any threads in the `on_worker_boot`
+# block.
+#
+# preload_app!
+
+# The code in the `on_worker_boot` will be called if you are using
+# clustered mode by specifying a number of `workers`. After each worker
+# process is booted this block will be run, if you are using `preload_app!`
+# option you will want to use this block to reconnect to any threads
+# or connections that may have been created at application boot, Ruby
+# cannot share connections between processes.
+#
+# on_worker_boot do
+# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
+# end
+
+# Allow puma to be restarted by `rails restart` command.
+plugin :tmp_restart
diff --git a/config/routes.rb b/config/routes.rb
index f77f07f1..ec57518c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,15 @@
-Activities::Application.routes.draw do
- resource :activities
+Rails.application.routes.draw do
+ resources :authentications, only: [:create, :destroy]
+ get '/auth/:provider/callback' => 'authentications#create'
+ devise_for :users, controllers: {
+ registrations: 'registrations',
+ sessions: 'sessions',
+ passwords: 'passwords'
+ }
+
+ resources :activities do
+ resource :participation, only: [:create, :destroy]
+ end
root to: 'activities#index'
end
diff --git a/config/secrets.yml b/config/secrets.yml
new file mode 100644
index 00000000..2e6a271e
--- /dev/null
+++ b/config/secrets.yml
@@ -0,0 +1,22 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+# You can use `rails secret` to generate a secure secret key.
+
+# Make sure the secrets in this file are kept private
+# if you're sharing your code publicly.
+
+development:
+ secret_key_base: f75dadf70cc2bc0cbff56359e28cee1e869ca1e86367e9233cfce38ebb3b86f672e4bee56708dd004d1a68ce761795329ea8a4d955a02c8de4d82ee8be162c83
+
+test:
+ secret_key_base: 626305f29b7acfcf56b95898061e106412583c141fcefed2604926f7a5aeee74883f2bb44899a95397401c6acf909b20415ac0cbf14d0634d44a27a82f2f4045
+
+# Do not keep production secrets in the repository,
+# instead read values from the environment.
+production:
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/config/spring.rb b/config/spring.rb
new file mode 100644
index 00000000..c9119b40
--- /dev/null
+++ b/config/spring.rb
@@ -0,0 +1,6 @@
+%w(
+ .ruby-version
+ .rbenv-vars
+ tmp/restart.txt
+ tmp/caching-dev.txt
+).each { |path| Spring.watch(path) }
diff --git a/db/migrate/20130508083406_devise_create_users.rb b/db/migrate/20130508083406_devise_create_users.rb
new file mode 100644
index 00000000..f24516c4
--- /dev/null
+++ b/db/migrate/20130508083406_devise_create_users.rb
@@ -0,0 +1,28 @@
+class DeviseCreateUsers < ActiveRecord::Migration
+ def change
+ create_table(:users) do |t|
+ ## Database authenticatable
+ t.string :email, null: false, default: ""
+ t.string :encrypted_password, null: false, default: ""
+
+ ## Recoverable
+ t.string :reset_password_token
+ t.datetime :reset_password_sent_at
+
+ ## Rememberable
+ t.datetime :remember_created_at
+
+ ## Trackable
+ t.integer :sign_in_count, default: 0
+ t.datetime :current_sign_in_at
+ t.datetime :last_sign_in_at
+ t.string :current_sign_in_ip
+ t.string :last_sign_in_ip
+
+ t.timestamps
+ end
+
+ add_index :users, :email, unique: true
+ add_index :users, :reset_password_token, unique: true
+ end
+end
diff --git a/db/migrate/20130508093002_create_authentications.rb b/db/migrate/20130508093002_create_authentications.rb
new file mode 100644
index 00000000..2b1706e2
--- /dev/null
+++ b/db/migrate/20130508093002_create_authentications.rb
@@ -0,0 +1,11 @@
+class CreateAuthentications < ActiveRecord::Migration
+ def change
+ create_table :authentications do |t|
+ t.integer :user_id
+ t.string :provider
+ t.string :uid
+
+ t.timestamps null: false
+ end
+ end
+end
diff --git a/db/migrate/20130508093144_add_name_to_users.rb b/db/migrate/20130508093144_add_name_to_users.rb
new file mode 100644
index 00000000..bac750eb
--- /dev/null
+++ b/db/migrate/20130508093144_add_name_to_users.rb
@@ -0,0 +1,5 @@
+class AddNameToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :name, :string
+ end
+end
diff --git a/db/migrate/20130508093327_add_oauth_handlers_to_users.rb b/db/migrate/20130508093327_add_oauth_handlers_to_users.rb
new file mode 100644
index 00000000..b74cdcc1
--- /dev/null
+++ b/db/migrate/20130508093327_add_oauth_handlers_to_users.rb
@@ -0,0 +1,6 @@
+class AddOauthHandlersToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :twitter_handle, :string
+ add_column :users, :github_handle, :string
+ end
+end
diff --git a/db/migrate/20130513115254_create_activities.rb b/db/migrate/20130513115254_create_activities.rb
new file mode 100644
index 00000000..cec1bf1b
--- /dev/null
+++ b/db/migrate/20130513115254_create_activities.rb
@@ -0,0 +1,16 @@
+class CreateActivities < ActiveRecord::Migration
+ def change
+ create_table :activities do |t|
+ t.string :name, null: false, default: ""
+ t.text :description
+ t.string :place
+ t.timestamp :start_at, null: false
+ t.integer :time_frame
+ t.integer :limit_of_participants
+
+ t.timestamps
+ end
+
+ add_index :activities, :name, unique: true
+ end
+end
diff --git a/db/migrate/20130526133400_add_creator_id_to_activities.rb b/db/migrate/20130526133400_add_creator_id_to_activities.rb
new file mode 100644
index 00000000..e361c45e
--- /dev/null
+++ b/db/migrate/20130526133400_add_creator_id_to_activities.rb
@@ -0,0 +1,5 @@
+class AddCreatorIdToActivities < ActiveRecord::Migration
+ def change
+ add_column :activities, :creator_id, :integer
+ end
+end
diff --git a/db/migrate/20130527054241_create_participations.rb b/db/migrate/20130527054241_create_participations.rb
new file mode 100644
index 00000000..c21a27d6
--- /dev/null
+++ b/db/migrate/20130527054241_create_participations.rb
@@ -0,0 +1,12 @@
+class CreateParticipations < ActiveRecord::Migration
+ def change
+ create_table :participations do |t|
+ t.integer :user_id
+ t.integer :activity_id
+
+ t.timestamps
+ end
+
+ add_column :activities, :participations_count, :integer, default: 0
+ end
+end
diff --git a/db/migrate/20130529174513_add_additional_fields_to_activity.rb b/db/migrate/20130529174513_add_additional_fields_to_activity.rb
new file mode 100644
index 00000000..4f0ca4cf
--- /dev/null
+++ b/db/migrate/20130529174513_add_additional_fields_to_activity.rb
@@ -0,0 +1,6 @@
+class AddAdditionalFieldsToActivity < ActiveRecord::Migration
+ def change
+ add_column :activities, :anytime, :boolean, default: false
+ add_column :activities, :requirements, :text
+ end
+end
diff --git a/db/migrate/20130529181136_remove_time_frame_from_activities.rb b/db/migrate/20130529181136_remove_time_frame_from_activities.rb
new file mode 100644
index 00000000..2ba8bfa5
--- /dev/null
+++ b/db/migrate/20130529181136_remove_time_frame_from_activities.rb
@@ -0,0 +1,5 @@
+class RemoveTimeFrameFromActivities < ActiveRecord::Migration
+ def change
+ remove_column :activities, :time_frame
+ end
+end
diff --git a/db/migrate/20130529181823_add_end_time_to_activities.rb b/db/migrate/20130529181823_add_end_time_to_activities.rb
new file mode 100644
index 00000000..8b5b659b
--- /dev/null
+++ b/db/migrate/20130529181823_add_end_time_to_activities.rb
@@ -0,0 +1,5 @@
+class AddEndTimeToActivities < ActiveRecord::Migration
+ def change
+ add_column :activities, :end_time, :datetime
+ end
+end
diff --git a/db/migrate/20130529181849_rename_start_at_in_activities.rb b/db/migrate/20130529181849_rename_start_at_in_activities.rb
new file mode 100644
index 00000000..32bbe9f9
--- /dev/null
+++ b/db/migrate/20130529181849_rename_start_at_in_activities.rb
@@ -0,0 +1,5 @@
+class RenameStartAtInActivities < ActiveRecord::Migration
+ def change
+ rename_column :activities, :start_at, :start_time
+ end
+end
diff --git a/db/migrate/20130529182104_start_time_can_be_null.rb b/db/migrate/20130529182104_start_time_can_be_null.rb
new file mode 100644
index 00000000..35109a9e
--- /dev/null
+++ b/db/migrate/20130529182104_start_time_can_be_null.rb
@@ -0,0 +1,5 @@
+class StartTimeCanBeNull < ActiveRecord::Migration
+ def change
+ change_column :activities, :start_time, :datetime, null: true
+ end
+end
diff --git a/db/migrate/20130530134900_set_anytime_to_true_by_default.rb b/db/migrate/20130530134900_set_anytime_to_true_by_default.rb
new file mode 100644
index 00000000..e20c75fc
--- /dev/null
+++ b/db/migrate/20130530134900_set_anytime_to_true_by_default.rb
@@ -0,0 +1,5 @@
+class SetAnytimeToTrueByDefault < ActiveRecord::Migration
+ def change
+ change_column :activities, :anytime, :boolean, default: true, null: false
+ end
+end
diff --git a/db/migrate/20130530152254_add_image_url_to_activity.rb b/db/migrate/20130530152254_add_image_url_to_activity.rb
new file mode 100644
index 00000000..7fb780b9
--- /dev/null
+++ b/db/migrate/20130530152254_add_image_url_to_activity.rb
@@ -0,0 +1,5 @@
+class AddImageUrlToActivity < ActiveRecord::Migration
+ def change
+ add_column :activities, :image_url, :string
+ end
+end
diff --git a/db/migrate/20130530184628_rename_place_to_location.rb b/db/migrate/20130530184628_rename_place_to_location.rb
new file mode 100644
index 00000000..d76f771a
--- /dev/null
+++ b/db/migrate/20130530184628_rename_place_to_location.rb
@@ -0,0 +1,5 @@
+class RenamePlaceToLocation < ActiveRecord::Migration
+ def change
+ rename_column :activities, :place, :location
+ end
+end
diff --git a/db/migrate/20130605211503_participations_count_cant_be_null.rb b/db/migrate/20130605211503_participations_count_cant_be_null.rb
new file mode 100644
index 00000000..b06ed0e5
--- /dev/null
+++ b/db/migrate/20130605211503_participations_count_cant_be_null.rb
@@ -0,0 +1,5 @@
+class ParticipationsCountCantBeNull < ActiveRecord::Migration
+ def change
+ change_column(:activities, :participations_count, :integer, default: 0, null: false)
+ end
+end
diff --git a/db/migrate/20130607184825_image_url_must_be_text_field.rb b/db/migrate/20130607184825_image_url_must_be_text_field.rb
new file mode 100644
index 00000000..42bfe625
--- /dev/null
+++ b/db/migrate/20130607184825_image_url_must_be_text_field.rb
@@ -0,0 +1,5 @@
+class ImageUrlMustBeTextField < ActiveRecord::Migration
+ def change
+ change_column :activities, :image_url, :text
+ end
+end
diff --git a/db/migrate/20130608105751_set_default_for_limit_of_participants.rb b/db/migrate/20130608105751_set_default_for_limit_of_participants.rb
new file mode 100644
index 00000000..5cf7117f
--- /dev/null
+++ b/db/migrate/20130608105751_set_default_for_limit_of_participants.rb
@@ -0,0 +1,5 @@
+class SetDefaultForLimitOfParticipants < ActiveRecord::Migration
+ def change
+ change_column :activities, :limit_of_participants, :integer, default: 10
+ end
+end
diff --git a/db/migrate/20150628112434_add_requires_eurucamp_ticket_to_activities.rb b/db/migrate/20150628112434_add_requires_eurucamp_ticket_to_activities.rb
new file mode 100644
index 00000000..b24238d8
--- /dev/null
+++ b/db/migrate/20150628112434_add_requires_eurucamp_ticket_to_activities.rb
@@ -0,0 +1,5 @@
+class AddRequiresEurucampTicketToActivities < ActiveRecord::Migration
+ def change
+ add_column :activities, :requires_eurucamp_ticket, :boolean, null: false, default: false
+ end
+end
diff --git a/db/migrate/20150724211941_change_anytime_default.rb b/db/migrate/20150724211941_change_anytime_default.rb
new file mode 100644
index 00000000..943fa802
--- /dev/null
+++ b/db/migrate/20150724211941_change_anytime_default.rb
@@ -0,0 +1,9 @@
+class ChangeAnytimeDefault < ActiveRecord::Migration
+ def up
+ change_column_default :activities, :anytime, false
+ end
+
+ def down
+ change_column_default :activities, :anytime, true
+ end
+end
diff --git a/db/migrate/20150725210346_add_show_participation.rb b/db/migrate/20150725210346_add_show_participation.rb
new file mode 100644
index 00000000..a019dfbf
--- /dev/null
+++ b/db/migrate/20150725210346_add_show_participation.rb
@@ -0,0 +1,5 @@
+class AddShowParticipation < ActiveRecord::Migration
+ def change
+ add_column :users, 'show_participation', :boolean, null: false, default: true
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index ea89ed53..4105880d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,9 +11,65 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 0) do
+ActiveRecord::Schema.define(version: 20150725210346) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
+ create_table "activities", force: true do |t|
+ t.string "name", default: "", null: false
+ t.text "description"
+ t.string "location"
+ t.datetime "start_time"
+ t.integer "limit_of_participants", default: 10
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "creator_id"
+ t.integer "participations_count", default: 0, null: false
+ t.boolean "anytime", default: false, null: false
+ t.text "requirements"
+ t.datetime "end_time"
+ t.text "image_url"
+ t.boolean "requires_eurucamp_ticket", default: false, null: false
+ end
+
+ add_index "activities", ["name"], name: "index_activities_on_name", unique: true, using: :btree
+
+ create_table "authentications", force: true do |t|
+ t.integer "user_id"
+ t.string "provider"
+ t.string "uid"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ create_table "participations", force: true do |t|
+ t.integer "user_id"
+ t.integer "activity_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "users", force: true do |t|
+ t.string "email", default: "", null: false
+ t.string "encrypted_password", default: "", null: false
+ t.string "reset_password_token"
+ t.datetime "reset_password_sent_at"
+ t.datetime "remember_created_at"
+ t.integer "sign_in_count", default: 0
+ t.datetime "current_sign_in_at"
+ t.datetime "last_sign_in_at"
+ t.string "current_sign_in_ip"
+ t.string "last_sign_in_ip"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "name"
+ t.string "twitter_handle"
+ t.string "github_handle"
+ t.boolean "show_participation", default: true, null: false
+ end
+
+ add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
+ add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
+
end
diff --git a/db/seeds.rb b/db/seeds.rb
index 4edb1e85..a7a27444 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -1,7 +1,28 @@
-# This file should contain all the record creation needed to seed the database with its default values.
-# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
-#
-# Examples:
-#
-# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
-# Mayor.create(name: 'Emanuel', city: cities.first)
+User.transaction do |tx|
+ event = Event.new("Test Event", Date.today, 14.days.from_now)
+ ultra_secure_password = "qweqweqwe"
+
+ creator = User.new(
+ email: "johnny@cash.com",
+ name: "Johnny Cash"
+ )
+ creator.password = creator.password_confirmation = ultra_secure_password
+ creator.save!
+
+ participant = User.new(
+ email: "johnny@begood.com", # go go!
+ name: "Johnny Begood"
+ )
+ participant.password = participant.password_confirmation = ultra_secure_password
+ participant.save!
+
+ activity = event.new_activity(creator,
+ name: "Party!",
+ start_time: 1.day.from_now.to_time,
+ end_time: 1.day.from_now.to_time + 4.hours,
+ location: "Pool",
+ limit_of_participants: 2
+ )
+ activity.save!
+ activity.new_participation(participant).save!
+end
diff --git a/lib/api_responder.rb b/lib/api_responder.rb
new file mode 100644
index 00000000..cc5e89fc
--- /dev/null
+++ b/lib/api_responder.rb
@@ -0,0 +1,27 @@
+# -*- encoding : utf-8 -*-
+class ApiResponder < ActionController::Responder
+
+ def to_html
+ if get? && resource.nil?
+ raise ActionController::RoutingError.new('Not Found')
+ else
+ super
+ end
+ end
+
+ protected
+
+ # This is the common behavior for formats associated with APIs, such as :xml and :json.
+ def api_behavior(error)
+ raise error unless resourceful?
+
+ if get?
+ resource.nil? ? display(resource, status: :not_found) : display(resource)
+ elsif post?
+ display resource, status: :created, location: api_location
+ else
+ head :no_content
+ end
+ end
+
+end
diff --git a/public/fonts/sonar-bold-webfont.eot b/public/fonts/sonar-bold-webfont.eot
new file mode 100755
index 00000000..1e438f94
Binary files /dev/null and b/public/fonts/sonar-bold-webfont.eot differ
diff --git a/public/fonts/sonar-bold-webfont.svg b/public/fonts/sonar-bold-webfont.svg
new file mode 100755
index 00000000..6963939e
--- /dev/null
+++ b/public/fonts/sonar-bold-webfont.svg
@@ -0,0 +1,241 @@
+
+
+
\ No newline at end of file
diff --git a/public/fonts/sonar-bold-webfont.ttf b/public/fonts/sonar-bold-webfont.ttf
new file mode 100755
index 00000000..68480da4
Binary files /dev/null and b/public/fonts/sonar-bold-webfont.ttf differ
diff --git a/public/fonts/sonar-bold-webfont.woff b/public/fonts/sonar-bold-webfont.woff
new file mode 100755
index 00000000..6368079b
Binary files /dev/null and b/public/fonts/sonar-bold-webfont.woff differ
diff --git a/public/fonts/sonar-medium-webfont.eot b/public/fonts/sonar-medium-webfont.eot
new file mode 100755
index 00000000..2b6d4257
Binary files /dev/null and b/public/fonts/sonar-medium-webfont.eot differ
diff --git a/public/fonts/sonar-medium-webfont.svg b/public/fonts/sonar-medium-webfont.svg
new file mode 100755
index 00000000..60756f34
--- /dev/null
+++ b/public/fonts/sonar-medium-webfont.svg
@@ -0,0 +1,241 @@
+
+
+
\ No newline at end of file
diff --git a/public/fonts/sonar-medium-webfont.ttf b/public/fonts/sonar-medium-webfont.ttf
new file mode 100755
index 00000000..d68d03f0
Binary files /dev/null and b/public/fonts/sonar-medium-webfont.ttf differ
diff --git a/public/fonts/sonar-medium-webfont.woff b/public/fonts/sonar-medium-webfont.woff
new file mode 100755
index 00000000..b2a1926e
Binary files /dev/null and b/public/fonts/sonar-medium-webfont.woff differ
diff --git a/public/fonts/sonar-normal-webfont.eot b/public/fonts/sonar-normal-webfont.eot
new file mode 100755
index 00000000..503285e8
Binary files /dev/null and b/public/fonts/sonar-normal-webfont.eot differ
diff --git a/public/fonts/sonar-normal-webfont.svg b/public/fonts/sonar-normal-webfont.svg
new file mode 100755
index 00000000..2d91df9d
--- /dev/null
+++ b/public/fonts/sonar-normal-webfont.svg
@@ -0,0 +1,241 @@
+
+
+
\ No newline at end of file
diff --git a/public/fonts/sonar-normal-webfont.ttf b/public/fonts/sonar-normal-webfont.ttf
new file mode 100755
index 00000000..710111a5
Binary files /dev/null and b/public/fonts/sonar-normal-webfont.ttf differ
diff --git a/public/fonts/sonar-normal-webfont.woff b/public/fonts/sonar-normal-webfont.woff
new file mode 100755
index 00000000..74ac17d0
Binary files /dev/null and b/public/fonts/sonar-normal-webfont.woff differ
diff --git a/screenshot.png b/screenshot.png
new file mode 100644
index 00000000..188113d0
Binary files /dev/null and b/screenshot.png differ
diff --git a/spec/controllers/activities_controller_spec.rb b/spec/controllers/activities_controller_spec.rb
new file mode 100644
index 00000000..fb9c062b
--- /dev/null
+++ b/spec/controllers/activities_controller_spec.rb
@@ -0,0 +1,171 @@
+require 'rails_helper'
+
+RSpec.describe ActivitiesController do
+ let(:current_user) { mock_model(User) }
+
+ let(:activity) { double(:activity) }
+ let(:activity_id) { "1" }
+ let(:invalid_activity) { double(:invalid_activity, errors: {name: "no way!"}) }
+ let(:current_event) { double(:current_event) }
+
+ before do
+ allow(controller).to receive(:current_event).and_return(current_event)
+ end
+
+ describe "#index" do
+ subject { get :index }
+
+ let(:current_user) { nil }
+ let(:activities_per_day) { double(:activities_per_day) }
+ let(:counters) { double(:counters) }
+
+ before do
+ expect(current_event).to receive(:activities_per_day).with(current_user, nil, nil).and_return(activities_per_day)
+ expect(current_event).to receive(:counters).with(current_user).and_return(counters)
+ end
+
+ it { is_expected.to render_template(:index) }
+ end
+
+ describe "#new" do
+ subject { get :new }
+
+ before do
+ sign_in(current_user)
+ expect(current_event).to receive(:new_activity).with(current_user, {}).and_return(activity)
+ end
+
+ it { is_expected.to render_template(:new) }
+ end
+
+ describe "#edit" do
+ subject { get :edit, params: { id: activity_id } }
+
+ before do
+ sign_in(current_user)
+ expect(current_event).to receive(:activity).with(activity_id).and_return(activity)
+ end
+
+ context "activity doesn't exist" do
+ let(:activity) { nil }
+
+ specify { expect { subject }.to raise_error(ActionController::RoutingError) }
+ end
+
+ context "activity exists" do
+
+ before do
+ expect(activity).to receive(:decorate).and_return(activity)
+ should_authorize(:edit, activity)
+ end
+
+ it { is_expected.to render_template(:edit) }
+ end
+
+ end
+
+ describe "#show" do
+ subject { get :show, params: { id: activity_id } }
+
+ before do
+ sign_in(current_user)
+ expect(current_event).to receive(:activity).with(activity_id).and_return(activity)
+ end
+
+ context "activity doesn't exist" do
+ let(:activity) { nil }
+
+ specify { expect { subject }.to raise_error(ActionController::RoutingError) }
+ end
+
+ context "activity exists" do
+
+ before do
+ expect(activity).to receive(:decorate).and_return(activity)
+ end
+
+ it { is_expected.to render_template(:show) }
+ end
+ end
+
+ describe "#create" do
+ subject { post :create, params: params }
+
+ before do
+ sign_in(current_user)
+ end
+
+ context "valid parameters" do
+ let(:attributes) { {location: "Location", name: "Name", start_time: 1.day.ago.to_s, end_time: 2.days.ago.to_s} }
+ let(:params) { {activity: attributes} }
+
+ before do
+ expect(current_event).to receive(:new_activity).with(current_user, ActionController::Parameters.new(attributes).permit!).and_return(activity)
+ expect(activity).to receive(:save).and_return(true)
+ end
+
+ it { is_expected.to redirect_to activities_path }
+ end
+
+ context "invalid parameters" do
+ let(:activity) { invalid_activity }
+ let(:params) { {activity: {x: 10}} }
+
+ before do
+ expect(current_event).to receive(:new_activity).with(current_user, ActionController::Parameters.new({}).permit!).and_return(activity)
+ expect(activity).to receive(:save).and_return(false)
+ end
+
+ it { is_expected.to render_template(:new) }
+ end
+ end
+
+ describe "#update" do
+ subject { put :update, params: params }
+ let(:params) { {id: activity_id, activity: attributes} }
+
+ before do
+ sign_in(current_user)
+ expect(current_event).to receive(:activity).with(activity_id).and_return(activity)
+ expect(activity).to receive(:decorate).and_return(activity)
+ should_authorize(:update, activity)
+ end
+
+ context "valid parameters" do
+ let(:attributes) { {location: "Location", name: "Name", start_time: 1.day.ago.to_s, end_time: 2.days.ago.to_s} }
+
+ before do
+ expect(activity).to receive(:update_attributes).with(ActionController::Parameters.new(attributes).permit!).and_return(true)
+ end
+
+ it { is_expected.to redirect_to edit_activity_path(activity) }
+ end
+
+ context "invalid parameters" do
+ let(:attributes) { {location: ""} }
+ let(:activity) { invalid_activity }
+
+ before do
+ expect(activity).to receive(:update_attributes).with(ActionController::Parameters.new(attributes).permit!).and_return(false)
+ end
+
+ it { is_expected.to render_template(:edit) }
+ end
+ end
+
+ describe "#destroy" do
+ subject { delete :destroy, params: {id: activity_id, confirm_delete: true} }
+
+ before do
+ sign_in(current_user)
+ expect(current_event).to receive(:activity).with(activity_id).and_return(activity)
+ expect(activity).to receive(:decorate).and_return(activity)
+ should_authorize(:destroy, activity)
+ expect(activity).to receive(:destroy).and_return(true)
+ end
+
+ it { is_expected.to redirect_to root_path }
+
+ end
+
+end
diff --git a/spec/controllers/authentications_controller_spec.rb b/spec/controllers/authentications_controller_spec.rb
new file mode 100644
index 00000000..3a7e86a6
--- /dev/null
+++ b/spec/controllers/authentications_controller_spec.rb
@@ -0,0 +1,71 @@
+require 'rails_helper'
+
+RSpec.describe AuthenticationsController do
+
+ let(:current_user) { mock_model(User) }
+ let(:authentications) { double(:authentications) }
+ let(:authentication) { double(:authentication) }
+ let(:authentication_id) { "1" }
+
+ before do
+ @request.env["devise.mapping"] = Devise.mappings[:user]
+ allow(current_user).to receive(:authentications).and_return(authentications)
+ end
+
+ describe '#create' do
+ subject { post :create }
+
+ before do
+ request.env['omniauth.auth'] = omniauth_data
+ end
+
+ context "no authentication" do
+ let(:omniauth_data) { { provider: 'none', uuid: 'none', info: { email: 'test@john.com', name: 'test'} } }
+ it { is_expected.to redirect_to new_user_registration_url }
+ end
+
+ context "no authentication or incorrect details" do
+ let(:omniauth_data) { { provider: 'none', uuid: 'none', info: {} } }
+ it { is_expected.to redirect_to new_user_registration_url }
+ end
+
+ context "user already logged in" do
+ let(:omniauth_data) { { provider: 'none', uuid: 'none' } }
+
+ before do
+ sign_in(current_user)
+ expect(authentications).to receive(:find_or_create_by).with({provider: nil, uid: nil})
+ expect(current_user).to receive(:apply_provider_handle).with(omniauth_data)
+ expect(current_user).to receive(:save).and_return(true)
+ end
+
+ context "when HTTP_REFERER set" do
+ before do
+ request.env['HTTP_REFERER'] = 'http://backtoreality/'
+ end
+
+ it { is_expected.to redirect_to 'http://backtoreality/' }
+ end
+
+ context "when HTTP_REFERER not set" do
+
+ it { is_expected.to redirect_to edit_user_registration_path }
+ end
+ end
+
+ end
+
+ describe "#delete" do
+ subject(:logout_action) { delete :destroy, params: { id: authentication_id } }
+
+ before do
+ sign_in(current_user)
+ expect(authentications).to receive(:find).with(authentication_id).and_return(authentication)
+ should_authorize(:destroy, authentication)
+ expect(authentication).to receive(:destroy).and_return(true)
+ end
+
+ it { is_expected.to redirect_to authentications_path }
+ end
+
+end
diff --git a/spec/controllers/participation_controller_spec.rb b/spec/controllers/participation_controller_spec.rb
new file mode 100644
index 00000000..5636947b
--- /dev/null
+++ b/spec/controllers/participation_controller_spec.rb
@@ -0,0 +1,82 @@
+require 'rails_helper'
+
+RSpec.describe ParticipationsController do
+ let(:current_user) { mock_model(User) }
+ let(:activity_id) { "1" }
+ let(:activity) { double(:activity) }
+ let(:participation) { double(:participation) }
+ let(:invalid_participation) { double(:participation, errors: {activity_id: "nahhhhh"}) }
+ let(:current_event) { double(:current_event) }
+
+ before do
+ allow(activity).to receive(:reload).and_return(activity)
+ allow(controller).to receive(:current_event).and_return(current_event)
+ end
+
+ describe "#create" do
+ context "with :js format" do
+ subject { post :create, params: {activity_id: activity_id, format: :js} }
+
+ before do
+ sign_in(current_user)
+
+ expect(current_event).to receive(:activity).with(activity_id).and_return(activity)
+ expect(activity).to receive(:decorate).and_return(activity)
+ allow(activity).to receive(:new_participation).with(current_user).and_return(participation)
+ end
+
+ context "valid parameters" do
+
+ before do
+ expect(activity).to receive(:full?).and_return(false)
+ expect(participation).to receive(:save).and_return(true)
+ end
+
+ it { is_expected.to render_template(:create) }
+ end
+
+ context "user is already a participant" do
+ let(:participation) { invalid_participation }
+
+ before do
+ expect(activity).to receive(:full?).and_return(false)
+ expect(participation).to receive(:save).and_return(false)
+ end
+
+ # TODO: moar specs needed
+ it { is_expected.to render_template(:create) }
+ end
+
+ context "activity is already full" do
+ before do
+ expect(activity).to receive(:full?).and_return(true)
+ expect(participation).not_to receive(:save)
+ end
+
+ it { is_expected.to render_template(:create) }
+ end
+ end
+ end
+
+ describe "#destroy" do
+ context "with :js format" do
+ subject { delete :destroy, params: { activity_id: activity_id }, format: :js }
+
+ before do
+ sign_in(current_user)
+
+ expect(current_event).to receive(:activity).with(activity_id).and_return(activity)
+ expect(activity).to receive(:decorate).and_return(activity)
+
+ expect(activity).to receive(:participation).with(current_user).and_return(participation)
+ should_authorize(:destroy, participation)
+
+ expect(participation).to receive(:destroy).and_return(true)
+ end
+
+ # TODO: moar specs needed
+ it { is_expected.to render_template(:destroy) }
+ end
+ end
+
+end
diff --git a/spec/decorators/activity_decorator_spec.rb b/spec/decorators/activity_decorator_spec.rb
new file mode 100644
index 00000000..5ec67c91
--- /dev/null
+++ b/spec/decorators/activity_decorator_spec.rb
@@ -0,0 +1,39 @@
+require 'rails_helper'
+
+RSpec.describe ActivityDecorator do
+ let (:activity) { FactoryGirl.build_stubbed(:activity, limit_of_participants: 20) }
+ let (:decorator) { ActivityDecorator.new(activity) }
+
+ describe "#spots_left" do
+ subject { decorator.open_spots }
+
+ before do
+ allow(activity).to receive(:participations_count).and_return(count)
+ end
+
+ context "no participants" do
+ let(:count) { 0 }
+
+ it { is_expected.to eq(20) }
+ end
+
+ context "some participants" do
+ let(:count) { 5 }
+
+ it { is_expected.to eq(15) }
+ end
+
+ context "too many participants" do
+ let(:count) { 25 }
+
+ it { is_expected.to eq(0) }
+ end
+
+ context "you're drunk Rails, go home!" do
+ # it seems Rails counter caches return negative values sometimes
+ let(:count) { -5 }
+
+ it { is_expected.to eq(20) }
+ end
+ end
+end
diff --git a/spec/decorators/participant_decorator_spec.rb b/spec/decorators/participant_decorator_spec.rb
new file mode 100644
index 00000000..31052371
--- /dev/null
+++ b/spec/decorators/participant_decorator_spec.rb
@@ -0,0 +1,40 @@
+require 'rails_helper'
+
+RSpec.describe ParticipantDecorator do
+ let(:user) { User.new }
+
+ subject do
+ ParticipantDecorator.new(user)
+ end
+
+ describe '#name' do
+ it 'delegates to the user' do
+ user.name = 'Blubb'
+ expect(subject.name).to eq(user.name)
+ end
+
+ context 'when the user does not want to be shown in activities' do
+ it 'is "Anonymous"' do
+ user.name = 'Blubb'
+ user.show_participation = false
+ expect(subject.name).to eq('Anonymous')
+ end
+ end
+ end
+
+ describe '#avatar_url' do
+ it 'returns the avatar url' do
+ user.twitter_handle = 'foobar'
+ expect(subject.avatar_url(48)).to match /http.*foobar/
+ end
+
+ context 'when the user does not want to be shown in activities' do
+ it 'is the default Gravatar image' do
+ default = 'http://www.gravatar.com/avatar/00000000000000000000000000000000.png?s=48'
+ user.twitter_handle = 'foobar'
+ user.show_participation = false
+ expect(subject.avatar_url(48)).to eq(default)
+ end
+ end
+ end
+end
diff --git a/spec/factories/activities.rb b/spec/factories/activities.rb
new file mode 100644
index 00000000..3730448d
--- /dev/null
+++ b/spec/factories/activities.rb
@@ -0,0 +1,13 @@
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :activity do
+ name "Party!"
+ start_time "2013/12/12 18:00"
+ end_time "2013/12/13 03:00"
+ anytime false
+ location "Ballroom"
+ creator { FactoryGirl.create(:user) }
+ event { Event.new("Some Conference", Time.parse("2013/12/10 18:00"), Time.parse("2013/12/18 18:00")) }
+ end
+end
diff --git a/spec/factories/authentications.rb b/spec/factories/authentications.rb
new file mode 100644
index 00000000..023ada09
--- /dev/null
+++ b/spec/factories/authentications.rb
@@ -0,0 +1,7 @@
+FactoryGirl.define do
+ factory :authentication do
+ uid { generate(:uid) }
+ provider "Provider"
+ user
+ end
+end
diff --git a/spec/factories/participations.rb b/spec/factories/participations.rb
new file mode 100644
index 00000000..a4c17b74
--- /dev/null
+++ b/spec/factories/participations.rb
@@ -0,0 +1,8 @@
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :participation do
+ participant{ FactoryGirl.create(:user) }
+ activity
+ end
+end
diff --git a/spec/factories/sequences.rb b/spec/factories/sequences.rb
new file mode 100644
index 00000000..6e19e88a
--- /dev/null
+++ b/spec/factories/sequences.rb
@@ -0,0 +1,4 @@
+FactoryGirl.define do
+ sequence(:email) { |n| "person#{n}@example.com" }
+ sequence(:uid) { |n| "uid#{n}" }
+end
diff --git a/spec/factories/users.rb b/spec/factories/users.rb
new file mode 100644
index 00000000..8f488ca6
--- /dev/null
+++ b/spec/factories/users.rb
@@ -0,0 +1,8 @@
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :user do
+ email { generate(:email) }
+ password "qweqweqwe"
+ end
+end
diff --git a/test/controllers/.keep b/spec/features/.keep
similarity index 100%
rename from test/controllers/.keep
rename to spec/features/.keep
diff --git a/spec/features/activites_spec.rb b/spec/features/activites_spec.rb
new file mode 100644
index 00000000..a5934017
--- /dev/null
+++ b/spec/features/activites_spec.rb
@@ -0,0 +1,92 @@
+require 'rails_helper'
+
+RSpec.describe "Activities", :type => :feature do
+ let!(:event) { Event.new }
+ let!(:creator) do
+ User.create!(
+ name: 'Creatoratorius',
+ email: 'test@example.com',
+ password: 'foobarbaz'
+ )
+ end
+ let!(:participant) do
+ User.create!(
+ name: 'Participanto',
+ email: 'toast@example.com',
+ password: 'foobarbaz'
+ )
+ end
+ let!(:anonymous_participant) do
+ User.create!(
+ name: 'AnonUser',
+ email: 'anon@example.com',
+ password: 'foobarbaz',
+ show_participation: false
+ )
+ end
+ let!(:activity) do
+ Activity.create!(
+ start_time: Time.zone.local(2015, 7, 30, 10),
+ end_time: Time.zone.local(2015, 7, 30, 11),
+ name: 'Test Activity',
+ location: 'There',
+ creator_id: creator.id,
+ event: event
+ )
+ end
+
+ before do
+ activity.participants << participant
+ activity.participants << anonymous_participant
+ end
+
+
+ context 'viewing an activity' do
+ it "view activity" do
+ login_as(participant)
+ visit "/activities/#{activity.id}"
+
+ expect(page.status_code).to eq(200)
+ expect(page).to have_xpath('//li[@title="Participanto"]')
+ expect(page).not_to have_xpath('//li[@title="AnonUser"]')
+ expect(page).to have_xpath('//li[@title="Anonymous"]')
+ end
+ end
+
+ context 'deleting an activity' do
+ it 'deletes activity when checkbox is checked' do
+ login_as(creator)
+ visit "/activities/#{activity.id}"
+ click_link 'Edit'
+ check 'Really delete this activity (with currently 2 participants)'
+ click_button 'Delete activity'
+
+ get_redirected_to_homepage
+ activity_is_deleted
+ end
+
+ it 'does not delete activity when checkbox is not checked' do
+ login_as(creator)
+ visit "/activities/#{activity.id}"
+ click_link 'Edit'
+
+ click_button 'Delete activity'
+
+ activity_is_not_deleted
+ end
+ end
+
+ def activity_is_not_deleted
+ expect(page).to have_content('Your activity could not be deleted.')
+ expect(Activity.exists?(activity.id)).to be_truthy
+ end
+
+ def get_redirected_to_homepage
+ expect(current_path).to eq(root_path)
+ end
+
+ def activity_is_deleted
+ expect(page).to have_content('Your activity has been deleted!')
+ expect(Activity.exists?(activity.id)).to be_falsy
+ end
+end
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
new file mode 100644
index 00000000..5352949d
--- /dev/null
+++ b/spec/helpers/application_helper_spec.rb
@@ -0,0 +1,18 @@
+require 'rails_helper'
+
+RSpec.describe ApplicationHelper do
+ describe '#avatar_url' do
+ subject { avatar_url(user, size) }
+ let(:size) { 64 }
+
+ context 'with a Twitter account' do
+ let(:user) { User.new(twitter_handle: 'isleofruby') }
+ it { is_expected.to match %r{//twitter.com/#{user.twitter_handle}/profile_image} }
+ end
+
+ context 'without a Twitter account' do
+ let(:user) { User.new }
+ it { is_expected.to match %r{//gravatar.com/avatar/\w+.png\?s=#{size}} }
+ end
+ end
+end
diff --git a/spec/lib/settings_spec.rb b/spec/lib/settings_spec.rb
new file mode 100644
index 00000000..e5be4d74
--- /dev/null
+++ b/spec/lib/settings_spec.rb
@@ -0,0 +1,20 @@
+require 'rails_helper'
+
+RSpec.describe "Settings" do
+
+ subject { Settings }
+
+ its(:host) { should_not be_blank }
+ its(:event) { should_not be_blank }
+
+ describe "#event" do
+
+ subject { Settings.event }
+
+ its(:name) { should_not be_blank }
+ its(:start_time) { should be_a_kind_of(Time) }
+ its(:end_time) { should be_a_kind_of(Time) }
+
+ end
+
+end
diff --git a/spec/models/activity_spec.rb b/spec/models/activity_spec.rb
new file mode 100644
index 00000000..fb42fea5
--- /dev/null
+++ b/spec/models/activity_spec.rb
@@ -0,0 +1,272 @@
+require 'rails_helper'
+
+RSpec.describe Activity do
+
+ let(:event) { double(:event) }
+ let(:creator) { mock_model(User) }
+
+ subject(:activity) { Activity.new }
+
+ describe "#new" do
+ its(:limit_of_participants) { should == 10 }
+ end
+
+ describe "#creator" do
+ before do
+ activity.creator = creator
+ end
+
+ its(:creator) { should == creator }
+ end
+
+ describe "#event" do
+ before do
+ activity.event = event
+ end
+
+ its(:event) { should == event }
+ end
+
+ describe ".recent" do
+ let(:recent_activities) { [double(:activity1), double(:activity2)] }
+ subject { Activity.recent }
+
+ before do
+ expect(Activity).to receive(:find_recent).and_return(recent_activities)
+ end
+
+ it { is_expected.to eq(recent_activities) }
+ end
+
+ describe "#limit_of_participants" do
+ subject { activity.limit_of_participants }
+
+ context "limit of participants is not set" do
+ it { is_expected.to eq(10) }
+ end
+ end
+
+
+ describe "#full_by" do
+ subject { activity.full_by }
+
+ context "limit of participants is not set" do
+ before do
+ allow(activity).to receive(:limit_of_participants).and_return(nil)
+ end
+
+ it { is_expected.to eq(0) }
+ end
+
+ context "limit of participants is set" do
+ before do
+ allow(activity).to receive(:limit_of_participants).and_return(10)
+ allow(activity).to receive(:participations_count).and_return(8)
+ end
+
+ it { is_expected.to eq(80) }
+ end
+
+ context "no participants" do
+ before do
+ allow(activity).to receive(:limit_of_participants).and_return(10)
+ allow(activity).to receive(:participations_count).and_return(0)
+ end
+
+ it { is_expected.to eq(0) }
+ end
+ end
+
+ describe "#anybody_can_join?" do
+ subject { activity.anybody_can_join? }
+
+ context "no limit set" do
+ before do
+ allow(activity).to receive(:limit_of_participants).and_return(nil)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context "limit set" do
+ before do
+ allow(activity).to receive(:limit_of_participants).and_return(10)
+ end
+
+ it { is_expected.to eq(false) }
+ end
+ end
+
+ describe "#today?" do
+ subject { activity.today? }
+
+ context "anytime set" do
+ before do
+ allow(activity).to receive(:anytime?).and_return(true)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context "today" do
+ before do
+ allow(activity).to receive(:start_time).and_return(2.days.ago.to_time)
+ allow(activity).to receive(:end_time).and_return(2.days.from_now.to_time)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context "not today" do
+ before do
+ allow(activity).to receive(:anytime?).and_return(false)
+ allow(activity).to receive(:start_time).and_return(2.days.from_now.to_time)
+ allow(activity).to receive(:end_time).and_return(10.days.from_now.to_time)
+ end
+
+ it { is_expected.to eq(false) }
+ end
+
+ end
+
+ describe "#full?" do
+ subject { activity.full? }
+
+ context "full" do
+ before do
+ allow(activity).to receive(:limit_of_participants).and_return(10)
+ allow(activity).to receive(:participations_count).and_return(10)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context "too full" do
+ before do
+ allow(activity).to receive(:limit_of_participants).and_return(10)
+ allow(activity).to receive(:participations_count).and_return(11)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context "not full" do
+ before do
+ allow(activity).to receive(:limit_of_participants).and_return(10)
+ allow(activity).to receive(:participations_count).and_return(8)
+ end
+
+ it { is_expected.to eq(false) }
+ end
+
+ end
+
+ describe "#upcoming?" do
+ subject { activity.upcoming? }
+
+ context "in the future" do
+ before do
+ allow(activity).to receive(:start_time).and_return(1.days.from_now.to_time)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context "not in the future" do
+ before do
+ allow(activity).to receive(:start_time).and_return(Time.now)
+ end
+
+ it { is_expected.to eq(false) }
+ end
+ end
+
+ describe "#new_participation" do
+ let(:user) { mock_model(User) }
+ let(:new_participation) { OpenStruct.new }
+ let(:args) { {} }
+ subject { activity.new_participation(user) }
+
+ before do
+ activity.participation_source = ->{ new_participation }
+ end
+
+ its(:participant) { should == user }
+ its(:activity) { should == activity }
+ it { is_expected.to eq(new_participation) }
+ end
+
+ describe '#dates' do
+ context 'for an activity happening on a single day' do
+ before do
+ activity.start_time = Time.zone.local(2015, 7, 30, 10)
+ activity.end_time = Time.zone.local(2015, 7, 30, 17)
+ end
+
+ it 'is the day of the activity' do
+ expect(activity.dates).to eq([Date.new(2015, 7, 30)])
+ end
+ end
+
+ context 'for an activity spanning multiple days' do
+ before do
+ activity.start_time = Time.zone.local(2015, 7, 30, 10)
+ activity.end_time = Time.zone.local(2015, 8, 3, 9)
+ end
+
+ it 'is all the days the activity spans' do
+ expect(activity.dates).to eq([
+ Date.new(2015, 7, 30),
+ Date.new(2015, 7, 31),
+ Date.new(2015, 8, 1),
+ Date.new(2015, 8, 2),
+ Date.new(2015, 8, 3)
+ ])
+ end
+ end
+ end
+
+ describe "validations" do
+
+ specify { expect { FactoryGirl.create(:activity).dup.save! }.to raise_exception(ActiveRecord::RecordInvalid) }
+
+ it { is_expected.to accept_values_for(:name, "Football game" ) }
+ it { is_expected.not_to accept_values_for(:name, "", nil) }
+
+ it { is_expected.to accept_values_for(:description, nil, "", "Wear some solid boots!")}
+
+ it { is_expected.not_to accept_values_for(:event, nil) }
+
+ it { is_expected.to accept_values_for(:location, "football pitch" ) }
+ it { is_expected.not_to accept_values_for(:location, "", nil) }
+
+ it { is_expected.to accept_values_for(:start_time, Time.now) }
+
+ it { is_expected.to accept_values_for(:end_time, Time.now) }
+
+ it { is_expected.to accept_values_for(:limit_of_participants, nil, 12, 100) }
+ it { is_expected.not_to accept_values_for(:limit_of_participants, -1, 0) }
+
+ it { is_expected.to accept_values_for(:image_url, nil, "http://com.com/image.gif", "https://com.com/image.gif") }
+ it { is_expected.not_to accept_values_for(:image_url, "http://com.co ge.gif", "ssh://com.com/image.gif", "blah")}
+
+ context "invalid time frame (wrong order)" do
+ subject { FactoryGirl.build(:activity, start_time: 10.days.ago.to_time, anytime: false) }
+
+ it { is_expected.not_to accept_values_for(:end_time, 15.days.ago.to_time) }
+ end
+
+ context "invalid time frame (out of scope)" do
+ let(:event) { Event.new("A name", 2.days.ago.to_time, 2.days.from_now.to_time ) }
+ subject { FactoryGirl.build(:activity, event: event, start_time: 10.days.ago.to_time, anytime: false) }
+
+ it { is_expected.to accept_values_for(:start_time, 1.days.ago.to_time) }
+ it { is_expected.not_to accept_values_for(:start_time, 15.days.ago.to_time) }
+
+ it { is_expected.to accept_values_for(:end_time, 1.days.from_now.to_time) }
+ it { is_expected.not_to accept_values_for(:end_time, 3.days.from_now.to_time) }
+ end
+
+ end
+
+end
diff --git a/spec/models/authentication_spec.rb b/spec/models/authentication_spec.rb
new file mode 100644
index 00000000..5d10b205
--- /dev/null
+++ b/spec/models/authentication_spec.rb
@@ -0,0 +1,25 @@
+require 'rails_helper'
+
+RSpec.describe Authentication do
+ subject { Authentication.new }
+
+ specify { expect { FactoryGirl.create(:activity).dup.save! }.to raise_exception(ActiveRecord::RecordInvalid) }
+
+ it { is_expected.to accept_values_for(:user_id, 10) }
+ it do
+ skip "Currently Removed"
+ # should_not accept_values_for(:user_id, nil, "") }
+ end
+
+ it { is_expected.to accept_values_for(:provider, "github", "twitter") }
+ it do
+ skip "Currently Removed"
+ # should_not accept_values_for(:provider, nil, "") }
+ end
+
+ it { is_expected.to accept_values_for(:uid, "asd123dasd", "x") }
+ it do
+ skip "Currently Removed"
+ # should_not accept_values_for(:uid, nil, "") }
+ end
+end
diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb
new file mode 100644
index 00000000..6744099c
--- /dev/null
+++ b/spec/models/event_spec.rb
@@ -0,0 +1,207 @@
+require 'rails_helper'
+
+RSpec.describe Event do
+
+ let(:start_time) { Date.parse("2012-10-10") }
+ let(:end_time) { Date.parse("2012-12-14") }
+ subject(:event) { Event.new("isleofruby", start_time, end_time) }
+
+ let(:proxy) { double(:proxy) }
+
+ describe "#new" do
+ its(:name) { should == "isleofruby" }
+ its(:start_time) { should == start_time }
+ its(:end_time) { should == end_time }
+ end
+
+ describe "#new_activity" do
+ let(:user) { mock_model(User) }
+ let(:args) { {} }
+ subject { event.new_activity(user, args) }
+
+ before do
+ event.activity_source = ->(x){ OpenStruct.new(x) }
+ end
+
+ context 'with activity defaults' do
+ its(:event) { should == event }
+ it { expect(subject).to be_a_kind_of OpenStruct }
+ its(:start_time) { should == start_time }
+ its(:end_time) { should == end_time }
+ end
+
+ context 'with activity params' do
+ let(:args) { {name: 'An activity', start_time: 5.hours.from_now, end_time: 12.hours.from_now} }
+ its(:name) { should == args[:name] }
+ its(:start_time) { should == args[:start_time] }
+ its(:end_time) { should == args[:end_time] }
+ end
+ end
+
+ describe "#activity" do
+ let(:activity) { OpenStruct.new }
+ let(:activity_id) { 1 }
+ subject { event.activity(activity_id) }
+
+ before do
+ expect(event).to receive(:find_activity).with(activity_id).and_return(activity)
+ end
+
+ it { is_expected.to eq(activity) }
+ its(:event) { should == event }
+ end
+
+ describe "#recent_activities" do
+ let(:recent_activities) { [mock_model(Activity)] }
+ subject { event.recent_activities }
+
+ before do
+ event.recent_activities_fetcher = ->{ recent_activities }
+ end
+
+ it { is_expected.to eq(recent_activities) }
+ end
+
+ describe "#all_activities" do
+ let(:activities) { [double(:activity1), double(:activity2)] }
+ let(:event) { Event.new }
+ subject { event.activities }
+
+ before do
+ event.all_activities_fetcher = ->{ activities }
+ end
+
+ it { is_expected.to eq(activities) }
+ end
+
+ describe '#activities_per_day' do
+ let(:activity1) {
+ double(:activity1,
+ dates: [Date.new(2015, 7, 30)],
+ start_time: Time.local(2015, 7, 30, 10))
+ }
+ let(:activity2) {
+ double(:activity2,
+ dates: [Date.new(2015, 7, 31)],
+ start_time: Time.local(2015, 7, 31, 11))
+ }
+ let(:activities) { [activity2, activity1] }
+
+ before do
+ event.all_activities_fetcher = ->{ activities }
+ end
+
+ it 'groups the activities per day' do
+ expect(event).to receive(:search_activities).with('author', 'query string', 'filter').and_return(activities)
+ expect(event.activities_per_day 'author', 'query string', 'filter')
+ .to eq({
+ Date.new(2015, 7, 30) => [activity1],
+ Date.new(2015, 7, 31) => [activity2]
+ })
+ end
+
+ it 'is ordered by day' do
+ allow(event).to receive(:search_activities).and_return(activities)
+ per_day = event.activities_per_day
+ expect(per_day.to_a.first.first).to eq(Date.new(2015, 7, 30))
+ expect(per_day.to_a.second.first).to eq(Date.new(2015, 7, 31))
+ end
+
+ it 'lists activities spanning multiple days for each day' do
+ activity = double(:activity, dates: [Date.new(2015, 7, 30), Date.new(2015, 7, 31), Date.new(2015, 8, 1)], start_time: Time.local(2015, 7, 30, 10))
+ allow(event).to receive(:search_activities).and_return([activity])
+ expect(event.activities_per_day).to eq({
+ Date.new(2015, 7, 30) => [activity],
+ Date.new(2015, 7, 31) => [activity],
+ Date.new(2015, 8, 1) => [activity]
+ })
+ end
+
+ it 'orders activities by start time' do
+ activity1 = double(:activity1, dates: [Date.new(2015, 7, 30), Date.new(2015, 7, 31)], start_time: Time.local(2015, 7, 30, 11))
+ activity2 = double(:activity2, dates: [Date.new(2015, 7, 30)], start_time: Time.local(2015, 7, 30, 10))
+ activity3 = double(:activity3, dates: [Date.new(2015, 7, 31)], start_time: Time.local(2015, 7, 31, 9))
+ allow(event).to receive(:search_activities).and_return([activity1, activity2, activity3])
+
+ expect(event.activities_per_day).to eq({
+ Date.new(2015, 7, 30) => [activity2, activity1],
+ Date.new(2015, 7, 31) => [activity1, activity3]
+ })
+ end
+ end
+
+ describe "#search_activities" do
+ let(:activities) { [double(:activity1), double(:activity2)] }
+
+ context "default args" do
+ subject { event.search_activities }
+
+ before do
+ event.all_activities_fetcher = ->{ activities }
+ end
+
+ it { is_expected.to eq(activities) }
+ end
+
+ context "by name" do
+ subject { event.search_activities(nil, "yummy", "all") }
+
+ before do
+ expect(Activity).to receive(:with_name_like).with("yummy").and_return(activities)
+ end
+
+ it { is_expected.to eq(activities) }
+ end
+
+ context "with filter" do
+ let(:user) { mock_model(User) }
+ subject { event.search_activities(user, "", filter) }
+
+ context "owner" do
+ let(:filter) { "owner" }
+
+ before do
+ expect(Activity).to receive(:all_activities).and_return(proxy)
+ expect(proxy).to receive(:created_by).with(user).and_return(activities)
+ end
+
+ it { is_expected.to eq(activities) }
+ end
+
+ context "participant" do
+ let(:filter) { "participant" }
+
+ before do
+ expect(Activity).to receive(:all_activities).and_return(proxy)
+ expect(proxy).to receive(:participated_by).with(user).and_return(activities)
+ end
+
+ it { is_expected.to eq(activities) }
+ end
+
+ context "today" do
+ let(:filter) { "today" }
+
+ before do
+ expect(Activity).to receive(:all_activities).and_return(proxy)
+ expect(proxy).to receive(:today).and_return(activities)
+ end
+
+ it { is_expected.to eq(activities) }
+ end
+
+ context "wrong filter" do
+ let(:filter) { "ownerx" }
+
+ before do
+ expect(Activity).to receive(:all_activities).and_return(activities)
+ end
+
+ it { is_expected.to eq(activities) }
+ end
+
+ end
+
+ end
+
+end
diff --git a/spec/models/participation_spec.rb b/spec/models/participation_spec.rb
new file mode 100644
index 00000000..27b1c197
--- /dev/null
+++ b/spec/models/participation_spec.rb
@@ -0,0 +1,17 @@
+require 'rails_helper'
+
+RSpec.describe Participation do
+
+ describe "validations" do
+
+ specify { expect { FactoryGirl.create(:participation).dup.save! }.to raise_exception(ActiveRecord::RecordInvalid) }
+
+ it { is_expected.to accept_values_for(:user_id, 1 ) }
+ it { is_expected.not_to accept_values_for(:user_id, "", nil) }
+
+ it { is_expected.to accept_values_for(:activity_id, 1 ) }
+ it { is_expected.not_to accept_values_for(:activity_id, "", nil) }
+
+ end
+
+end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
new file mode 100644
index 00000000..0e0713e6
--- /dev/null
+++ b/spec/models/user_spec.rb
@@ -0,0 +1,185 @@
+require 'rails_helper'
+
+RSpec.describe User do
+
+ describe "#connected_with_twitter?" do
+ subject { user.connected_with_twitter? }
+ let(:user) { User.new }
+
+ context "not connected with Twitter account" do
+ before do
+ expect(user).to receive(:provider_connected?).with("twitter").and_return(false)
+ end
+
+ it { is_expected.to eq(false)}
+ end
+
+ context "connected with Twitter account" do
+ before do
+ expect(user).to receive(:provider_connected?).with("twitter").and_return(true)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ end
+
+ describe "#connected_with_github?" do
+ subject { user.connected_with_github? }
+ let(:user) { User.new }
+
+ context "not connected with Github account" do
+ before do
+ expect(user).to receive(:provider_connected?).with("github").and_return(false)
+ end
+
+ it { is_expected.to eq(false)}
+ end
+
+ context "connected with Github account" do
+ before do
+ expect(user).to receive(:provider_connected?).with("github").and_return(true)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+ end
+
+ describe "#apply_provider_handle" do
+ subject { user.apply_provider_handle(params) }
+ let(:user) { User.new }
+
+ context "no data provided" do
+ let(:params) { {} }
+
+ it { is_expected.to eq(user) }
+ end
+
+ context "data provided" do
+ let(:params) { { "uid" => "123ASD", "provider" => "github", "info" => {"nickname" => "johnny"} } }
+
+ specify { expect{subject}.to change(user, :github_handle).to("johnny") }
+
+ it { is_expected.to eq(user) }
+ end
+
+ end
+
+ describe "#no_oauth_connected?" do
+ subject { user.no_oauth_connected? }
+ let(:user) { FactoryGirl.create(:user) }
+
+ context "account connected" do
+ context "password set" do
+ it { is_expected.to eq(true) }
+ end
+ end
+
+ context "no account connected" do
+ context "password set" do
+ it { is_expected.to eq(true) }
+ end
+
+ context "password not set" do
+ let(:user) { User.new }
+ it { is_expected.to eq(false) }
+ end
+ end
+ end
+
+ describe "#password_required?" do
+ subject { user.password_required? }
+ let(:user) { FactoryGirl.create(:user) }
+
+ context "no account connected" do
+ it { is_expected.to eq(true) }
+ end
+
+ context "account connected" do
+ let(:authentications) { [double(:authentication)] }
+
+ before do
+ expect(user).to receive(:authentications).and_return(authentications)
+ end
+
+ it { is_expected.to eq(false) }
+ end
+
+ end
+
+ describe "#update_without_password" do
+ subject { user.update_without_password(params) }
+ let(:user) { FactoryGirl.create(:user) }
+
+ context "no password provided" do
+ let(:params) { {name: "Zbigniew" } }
+
+ specify { expect { subject }.to change(user, :name) }
+
+ specify { expect { subject }.to_not change(user, :encrypted_password) }
+ end
+
+ context "password" do
+ let(:params) { {name: "Zbigniew", password: "qweqwe123123", password_confirmation: "qweqweqwe123123" } }
+
+ specify { expect { subject }.to change(user, :name) }
+
+ specify { expect { subject }.to change(user, :encrypted_password) }
+ end
+ end
+
+
+ describe "#apply_omniauth" do
+ subject { user.apply_omniauth(params) }
+ let(:user) { FactoryGirl.create(:user, name: nil) }
+
+ context "no data provided" do
+ let(:params) { {} }
+
+ it { is_expected.to be_a_kind_of(Authentication) }
+ its(:user) { should == user }
+
+ it do
+ pending "Currently Removed"
+ is_expected.to be_invalid
+ end
+ end
+
+ context "data provided" do
+ context "with info" do
+ let(:params) { { 'info' => {"email" => "ala@ala.com", "name" => "Ala"} } }
+
+ specify { expect{subject}.to change(user, :name).to("Ala") }
+
+ specify { expect{subject}.to_not change(user, :email) }
+
+ it { is_expected.to be_a_kind_of(Authentication) }
+ its(:user) { should == user }
+ end
+
+ context "without info" do
+ let(:params) { { "uid" => "123ASD", "provider" => "github" } }
+
+ specify { expect{subject}.to_not change(user, :email) }
+
+ it { is_expected.to be_a_kind_of(Authentication) }
+ its(:user) { should == user }
+ end
+ end
+ end
+
+ describe "validations" do
+
+ subject { User.new }
+
+ it { is_expected.to accept_values_for(:email, "xx@xx.com" ) }
+ it { is_expected.not_to accept_values_for(:email, "", nil, " x @ x.com", "123") }
+
+ it { is_expected.to accept_values_for(:password, "qweqweqwe" ) }
+ it { is_expected.not_to accept_values_for(:password, "qweqwe", nil, "") }
+
+ it { is_expected.to accept_values_for(:name, nil, "", "Florian Gęga") }
+
+ end
+
+end
diff --git a/spec/other/factories_spec.rb b/spec/other/factories_spec.rb
new file mode 100644
index 00000000..246f61e1
--- /dev/null
+++ b/spec/other/factories_spec.rb
@@ -0,0 +1,10 @@
+require 'rails_helper'
+
+RSpec.describe 'validate FactoryGirl factories' do
+ FactoryGirl.factories.each do |factory|
+ context "with factory for :#{factory.name}" do
+ subject { FactoryGirl.build(factory.name) }
+ it { is_expected.to be_valid, subject.errors.full_messages.join(", ") }
+ end
+ end
+end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
new file mode 100644
index 00000000..dd04ca27
--- /dev/null
+++ b/spec/rails_helper.rb
@@ -0,0 +1,85 @@
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+ENV["RAILS_ENV"] ||= 'test'
+require 'simplecov'
+SimpleCov.start 'rails'
+require File.expand_path("../../config/environment", __FILE__)
+require 'rspec/rails'
+require 'capybara/rails'
+
+Capybara.configure do |config|
+ config.default_max_wait_time = 5
+ # config.match = :one
+ # config.exact_options = true
+ # config.ignore_hidden_elements = true
+ # config.visible_text_only = true
+end
+
+# Requires supporting ruby files with custom matchers and macros, etc,
+# in spec/support/ and its subdirectories.
+Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
+
+OmniAuth.config.test_mode = true
+
+OmniAuth.config.add_mock(:github, {
+ uid: 'xc8b12448990eaef0b420f7153ec8d58',
+ nickname: 'rockstar',
+ email: 'user@99cookies.com',
+ image: 'rockstar.jpg'
+})
+OmniAuth.config.add_mock(:twitter, {
+ uid: 'xc8b12448990eaef0b420f7153ec8d58',
+ nickname: 'rockstar'
+})
+
+Devise.stretches = 1
+Rails.logger.level = 4
+
+class ActiveRecord::Base
+ mattr_accessor :shared_connection
+ @@shared_connection = nil
+
+ def self.connection
+ @@shared_connection || retrieve_connection
+ end
+end
+
+# Checks for pending migrations before tests are run.
+# If you are not using ActiveRecord, you can remove this line.
+ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
+
+RSpec.configure do |config|
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+
+ # If true, the base class of anonymous controllers will be inferred
+ # automatically. This will be the default behavior in future versions of
+ # rspec-rails.
+ config.infer_base_class_for_anonymous_controllers = false
+
+ config.include Devise::Test::ControllerHelpers, type: :controller
+ config.include Warden::Test::Helpers
+ config.before :suite do
+ Warden.test_mode!
+ end
+ config.after :each do
+ Warden.test_reset!
+ end
+ config.include ControllerHelpers, type: :controller
+ config.include JsonSpec::Helpers, type: :controller
+
+ # rspec-rails 3 will no longer automatically infer an example group's spec type
+ # from the file location. You can explicitly opt-in to the feature using this
+ # config option.
+ # To explicitly tag specs without using automatic inference, set the `:type`
+ # metadata manually:
+ #
+ # describe ThingsController, :type => :controller do
+ # # Equivalent to being in spec/controllers
+ # end
+ config.infer_spec_type_from_file_location!
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644
index 00000000..a556838a
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1,88 @@
+# This file was generated by the `rails generate rspec:install` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# The generated `.rspec` file contains `--require spec_helper` which will cause
+# this file to always be loaded, without a need to explicitly require it in any
+# files.
+#
+# Given that it is always loaded, you are encouraged to keep this file as
+# light-weight as possible. Requiring heavyweight dependencies from this file
+# will add to the boot time of your test suite on EVERY test run, even for an
+# individual file that may not need all of that loaded. Instead, consider making
+# a separate helper file that requires the additional dependencies and performs
+# the additional setup, and require it from the spec files that actually need
+# it.
+#
+# The `.rspec` file also contains a few flags that are not defaults but that
+# users commonly want.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+RSpec.configure do |config|
+ # rspec-expectations config goes here. You can use an alternate
+ # assertion/expectation library such as wrong or the stdlib/minitest
+ # assertions if you prefer.
+ config.expect_with :rspec do |expectations|
+ # This option will default to `true` in RSpec 4. It makes the `description`
+ # and `failure_message` of custom matchers include text for helper methods
+ # defined using `chain`, e.g.:
+ # be_bigger_than(2).and_smaller_than(4).description
+ # # => "be bigger than 2 and smaller than 4"
+ # ...rather than:
+ # # => "be bigger than 2"
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
+ end
+
+ # rspec-mocks config goes here. You can use an alternate test double
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
+ config.mock_with :rspec do |mocks|
+ # Prevents you from mocking or stubbing a method that does not exist on
+ # a real object. This is generally recommended, and will default to
+ # `true` in RSpec 4.
+ mocks.verify_partial_doubles = true
+ end
+
+ # These two settings work together to allow you to limit a spec run
+ # to individual examples or groups you care about by tagging them with
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
+ # get run.
+ config.filter_run :focus
+ config.run_all_when_everything_filtered = true
+
+ # Allows RSpec to persist some state between runs in order to support
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
+ # you configure your source control system to ignore this file.
+ # config.example_status_persistence_file_path = "spec/examples.txt"
+
+ # Limits the available syntax to the non-monkey patched syntax that is
+ # recommended. For more details, see:
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
+ config.disable_monkey_patching!
+
+ # Many RSpec users commonly either run the entire suite or an individual
+ # file, and it's useful to allow more verbose output when running an
+ # individual spec file.
+ if config.files_to_run.one?
+ # Use the documentation formatter for detailed output,
+ # unless a formatter has already been configured
+ # (e.g. via a command-line flag).
+ config.default_formatter = 'doc'
+ end
+
+ # Print the 10 slowest examples and example groups at the
+ # end of the spec run, to help surface which specs are running
+ # particularly slow.
+ # config.profile_examples = 10
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = :random
+
+ # Seed global randomization in this process using the `--seed` CLI option.
+ # Setting this allows you to use `--seed` to deterministically reproduce
+ # test failures related to randomization by passing the same `--seed` value
+ # as the one that triggered the failure.
+ Kernel.srand config.seed
+end
diff --git a/spec/support/helpers/controller_helpers.rb b/spec/support/helpers/controller_helpers.rb
new file mode 100644
index 00000000..c6c5d3cc
--- /dev/null
+++ b/spec/support/helpers/controller_helpers.rb
@@ -0,0 +1,16 @@
+module ControllerHelpers
+ def should_authorize(action, subject)
+ expect(controller).to receive(:authorize!).with(action, subject).and_return(true)
+ end
+
+ def sign_in(user = double('user'))
+ if user.nil?
+ allow(request.env['warden']).to receive(:authenticate!).
+ and_throw(:warden, {scope: :user})
+ allow(controller).to receive_messages current_user: nil
+ else
+ allow(request.env['warden']).to receive_messages authenticate!: user
+ allow(controller).to receive_messages current_user: user
+ end
+ end
+end
diff --git a/test/fixtures/.keep b/spec/support/steps/.keep
similarity index 100%
rename from test/fixtures/.keep
rename to spec/support/steps/.keep
diff --git a/test/helpers/.keep b/test/helpers/.keep
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/integration/.keep b/test/integration/.keep
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/mailers/.keep b/test/mailers/.keep
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/models/.keep b/test/models/.keep
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/test_helper.rb b/test/test_helper.rb
deleted file mode 100644
index 990fea40..00000000
--- a/test/test_helper.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-ENV["RAILS_ENV"] = "test"
-require 'simplecov'
-SimpleCov.start 'rails'
-require File.expand_path('../../config/environment', __FILE__)
-require 'rails/test_help'
-
-class ActiveSupport::TestCase
- ActiveRecord::Migration.check_pending!
-
- # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
- #
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
- # -- they do not yet inherit this setting
- fixtures :all
-
- # Add more helper methods to be used by all tests here...
-end
diff --git a/vendor/assets/javascripts/jquery.dotdotdot.min.js b/vendor/assets/javascripts/jquery.dotdotdot.min.js
new file mode 100644
index 00000000..7b0d17a1
--- /dev/null
+++ b/vendor/assets/javascripts/jquery.dotdotdot.min.js
@@ -0,0 +1,15 @@
+/*
+ * jQuery dotdotdot 1.6.1
+ *
+ * Copyright (c) 2013 Fred Heusschen
+ * www.frebsite.nl
+ *
+ * Plugin website:
+ * dotdotdot.frebsite.nl
+ *
+ * Dual licensed under the MIT and GPL licenses.
+ * http://en.wikipedia.org/wiki/MIT_License
+ * http://en.wikipedia.org/wiki/GNU_General_Public_License
+ */
+
+!function(a){function c(a,b,c){var d=a.children(),e=!1;a.empty();for(var g=0,h=d.length;h>g;g++){var i=d.eq(g);if(a.append(i),c&&a.append(c),f(a,b)){i.remove(),e=!0;break}c&&c.detach()}return e}function d(b,c,g,h,i){var j=b.contents(),k=!1;b.empty();for(var l="table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style",m=0,n=j.length;n>m&&!k;m++){var o=j[m],p=a(o);"undefined"!=typeof o&&(b.append(p),i&&b[b.is(l)?"after":"append"](i),3==o.nodeType?f(g,h)&&(k=e(p,c,g,h,i)):k=d(p,c,g,h,i),k||i&&i.detach())}return k}function e(a,b,c,d,h){var k=!1,l=a[0];if("undefined"==typeof l)return!1;for(var m=j(l),n=-1!==m.indexOf(" ")?" ":"\u3000",o="letter"==d.wrap?"":n,p=m.split(o),q=-1,r=-1,s=0,t=p.length-1;t>=s&&(0!=s||0!=t);){var u=Math.floor((s+t)/2);if(u==r)break;r=u,i(l,p.slice(0,r+1).join(o)+d.ellipsis),f(c,d)?t=r:(q=r,s=r),t==s&&0==t&&d.fallbackToLetter&&(o="",p=p[0].split(o),q=-1,r=-1,s=0,t=p.length-1)}if(-1==q||1==p.length&&0==p[0].length){var v=a.parent();a.remove();var w=h?h.length:0;if(v.contents().size()>w){var x=v.contents().eq(-1-w);k=e(x,b,c,d,h)}else{var y=v.prev(),l=y.contents().eq(-1)[0];if("undefined"!=typeof l){var m=g(j(l),d);i(l,m),h&&y.append(h),v.remove(),k=!0}}}else m=g(p.slice(0,q+1).join(o),d),k=!0,i(l,m);return k}function f(a,b){return a.innerHeight()>b.maxHeight}function g(b,c){for(;a.inArray(b.slice(-1),c.lastCharacter.remove)>-1;)b=b.slice(0,-1);return a.inArray(b.slice(-1),c.lastCharacter.noEllipsis)<0&&(b+=c.ellipsis),b}function h(a){return{width:a.innerWidth(),height:a.innerHeight()}}function i(a,b){a.innerText?a.innerText=b:a.nodeValue?a.nodeValue=b:a.textContent&&(a.textContent=b)}function j(a){return a.innerText?a.innerText:a.nodeValue?a.nodeValue:a.textContent?a.textContent:""}function k(b,c){return"undefined"==typeof b?!1:b?"string"==typeof b?(b=a(b,c),b.length?b:!1):"object"==typeof b?"undefined"==typeof b.jquery?!1:b:!1:!1}function l(a){for(var b=a.innerHeight(),c=["paddingTop","paddingBottom"],d=0,e=c.length;e>d;d++){var f=parseInt(a.css(c[d]),10);isNaN(f)&&(f=0),b-=f}return b}function m(a,b){return a?(b="string"==typeof b?"dotdotdot: "+b:["dotdotdot:",b],"undefined"!=typeof window.console&&"undefined"!=typeof window.console.log&&window.console.log(b),!1):!1}if(!a.fn.dotdotdot){a.fn.dotdotdot=function(e){if(0==this.length)return e&&e.debug===!1||m(!0,'No element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){a(this).dotdotdot(e)});var g=this;g.data("dotdotdot")&&g.trigger("destroy.dot"),g.data("dotdotdot-style",g.attr("style")),g.css("word-wrap","break-word"),"nowrap"===g.css("white-space")&&g.css("white-space","normal"),g.bind_events=function(){return g.bind("update.dot",function(b,e){b.preventDefault(),b.stopPropagation(),j.maxHeight="number"==typeof j.height?j.height:l(g),j.maxHeight+=j.tolerance,"undefined"!=typeof e&&(("string"==typeof e||e instanceof HTMLElement)&&(e=a("").append(e).contents()),e instanceof a&&(i=e)),q=g.wrapInner('').children(),q.empty().append(i.clone(!0)).css({height:"auto",width:"auto",border:"none",padding:0,margin:0});var h=!1,k=!1;return n.afterElement&&(h=n.afterElement.clone(!0),n.afterElement.remove()),f(q,j)&&(k="children"==j.wrap?c(q,j,h):d(q,g,q,j,h)),q.replaceWith(q.contents()),q=null,a.isFunction(j.callback)&&j.callback.call(g[0],k,i),n.isTruncated=k,k}).bind("isTruncated.dot",function(a,b){return a.preventDefault(),a.stopPropagation(),"function"==typeof b&&b.call(g[0],n.isTruncated),n.isTruncated}).bind("originalContent.dot",function(a,b){return a.preventDefault(),a.stopPropagation(),"function"==typeof b&&b.call(g[0],i),i}).bind("destroy.dot",function(a){a.preventDefault(),a.stopPropagation(),g.unwatch().unbind_events().empty().append(i).attr("style",g.data("dotdotdot-style")).data("dotdotdot",!1)}),g},g.unbind_events=function(){return g.unbind(".dot"),g},g.watch=function(){if(g.unwatch(),"window"==j.watch){var b=a(window),c=b.width(),d=b.height();b.bind("resize.dot"+n.dotId,function(){c==b.width()&&d==b.height()&&j.windowResizeFix||(c=b.width(),d=b.height(),p&&clearInterval(p),p=setTimeout(function(){g.trigger("update.dot")},10))})}else o=h(g),p=setInterval(function(){var a=h(g);(o.width!=a.width||o.height!=a.height)&&(g.trigger("update.dot"),o=h(g))},100);return g},g.unwatch=function(){return a(window).unbind("resize.dot"+n.dotId),p&&clearInterval(p),g};var i=g.contents(),j=a.extend(!0,{},a.fn.dotdotdot.defaults,e),n={},o={},p=null,q=null;return j.lastCharacter.remove instanceof Array||(j.lastCharacter.remove=a.fn.dotdotdot.defaultArrays.lastCharacter.remove),j.lastCharacter.noEllipsis instanceof Array||(j.lastCharacter.noEllipsis=a.fn.dotdotdot.defaultArrays.lastCharacter.noEllipsis),n.afterElement=k(j.after,g),n.isTruncated=!1,n.dotId=b++,g.data("dotdotdot",!0).bind_events().trigger("update.dot"),j.watch&&g.watch(),g},a.fn.dotdotdot.defaults={ellipsis:"... ",wrap:"word",fallbackToLetter:!0,lastCharacter:{},tolerance:0,callback:null,after:null,height:null,watch:!1,windowResizeFix:!0,debug:!1},a.fn.dotdotdot.defaultArrays={lastCharacter:{remove:[" ","\u3000",",",";",".","!","?"],noEllipsis:[]}};var b=1,n=a.fn.html;a.fn.html=function(a){return"undefined"!=typeof a?this.data("dotdotdot")&&"function"!=typeof a?this.trigger("update",[a]):n.call(this,a):n.call(this)};var o=a.fn.text;a.fn.text=function(b){if("undefined"!=typeof b){if(this.data("dotdotdot")){var c=a("");return c.text(b),b=c.html(),c.remove(),this.trigger("update",[b])}return o.call(this,b)}return o.call(this)}}}(jQuery);
\ No newline at end of file
diff --git a/vendor/assets/javascripts/jquery.easing.min.js b/vendor/assets/javascripts/jquery.easing.min.js
new file mode 100644
index 00000000..83a43249
--- /dev/null
+++ b/vendor/assets/javascripts/jquery.easing.min.js
@@ -0,0 +1,44 @@
+/*
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
+ *
+ * Uses the built in easing capabilities added In jQuery 1.1
+ * to offer multiple easing options
+ *
+ * TERMS OF USE - EASING EQUATIONS
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright © 2001 Robert Penner
+ * All rights reserved.
+ *
+ * TERMS OF USE - jQuery Easing
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright © 2008 George McGinley Smith
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g
+
+ settings =
+ strokeWidth : 6
+ strokeColor : '#15d701'
+ strokeColorFull: '#e73921'
+ duration : 1500
+ easing : 'easeOutBounce'
+
+ settings = $.extend settings, options
+
+ init = ->
+ $el = $(@)
+ size = $el.width()
+ canvasSize = size + settings.strokeWidth * 2
+
+ # this is the value we want to display
+ progress = settings.progress || parseInt($el.data('progress'))
+
+ # when the value > 100 use different color
+ color = if progress >= 100 then settings.strokeColorFull else settings.strokeColor
+
+ # wrap image
+ $wrapper = $('', class: 'progress-wrapper').css
+ position: 'relative'
+ # padding : settings.strokeWidth
+ $el.wrap($wrapper)
+
+ # generate canvas
+ $canvas = $('')
+ .attr(width: canvasSize, height: canvasSize)
+ .css
+ position: 'absolute'
+ zIndex : 1
+ left : 0
+ top : 0
+ $el.after($canvas)
+ context = $canvas.get(0).getContext("2d")
+
+ # animated call to render
+ $(progress: 0).animate({
+ progress: progress
+ },{
+ duration : settings.duration
+ queue : false
+ easing : settings.easing
+ step : (percentage) -> render(percentage, context, color)
+ })
+
+ percentageToRadians = (percentage) ->
+ (1.5 - (percentage * 2 / 100)) * Math.PI
+
+ render = (percentage, context, color) ->
+ canvasSize = context.canvas.width
+ context.clearRect(0, 0, canvasSize, canvasSize)
+ context.beginPath()
+ context.arc(canvasSize / 2, # origin x
+ canvasSize / 2, # origin y
+ canvasSize / 2 - settings.strokeWidth / 2, # radius
+ percentageToRadians(percentage), # start angle
+ 1.5 * Math.PI, # end angle
+ false)
+ context.strokeStyle = color
+ context.lineCap = 'round'
+ context.lineWidth = settings.strokeWidth
+ context.stroke()
+
+ @each -> init.call(@)
diff --git a/vendor/assets/javascripts/modernizr.min.js b/vendor/assets/javascripts/modernizr.min.js
new file mode 100644
index 00000000..2dd634df
--- /dev/null
+++ b/vendor/assets/javascripts/modernizr.min.js
@@ -0,0 +1,4 @@
+/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
+ * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-flexboxlegacy-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-canvas-hashchange-shiv-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
+ */
+;window.Modernizr=function(a,b,c){function B(a){j.cssText=a}function C(a,b){return B(n.join(a+";")+(b||""))}function D(a,b){return typeof a===b}function E(a,b){return!!~(""+a).indexOf(b)}function F(a,b){for(var d in a){var e=a[d];if(!E(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function G(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:D(f,"function")?f.bind(d||b):f}return!1}function H(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return D(b,"string")||D(b,"undefined")?F(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),G(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l=":)",m={}.toString,n=" -webkit- -moz- -o- -ms- ".split(" "),o="Webkit Moz O ms",p=o.split(" "),q=o.toLowerCase().split(" "),r={},s={},t={},u=[],v=u.slice,w,x=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["",'"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},y=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=D(e[d],"function"),D(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),z={}.hasOwnProperty,A;!D(z,"undefined")&&!D(z.call,"undefined")?A=function(a,b){return z.call(a,b)}:A=function(a,b){return b in a&&D(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=v.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(v.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(v.call(arguments)))};return e}),r.flexbox=function(){return H("flexWrap")},r.flexboxlegacy=function(){return H("boxDirection")},r.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},r.hashchange=function(){return y("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},r.rgba=function(){return B("background-color:rgba(150,255,150,.5)"),E(j.backgroundColor,"rgba")},r.hsla=function(){return B("background-color:hsla(120,40%,100%,.5)"),E(j.backgroundColor,"rgba")||E(j.backgroundColor,"hsla")},r.multiplebgs=function(){return B("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},r.backgroundsize=function(){return H("backgroundSize")},r.borderimage=function(){return H("borderImage")},r.borderradius=function(){return H("borderRadius")},r.boxshadow=function(){return H("boxShadow")},r.textshadow=function(){return b.createElement("div").style.textShadow===""},r.opacity=function(){return C("opacity:.55"),/^0.55$/.test(j.opacity)},r.cssanimations=function(){return H("animationName")},r.csscolumns=function(){return H("columnCount")},r.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return B((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),E(j.backgroundImage,"gradient")},r.cssreflections=function(){return H("boxReflect")},r.csstransforms=function(){return!!H("transform")},r.csstransforms3d=function(){var a=!!H("perspective");return a&&"webkitPerspective"in g.style&&x("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},r.csstransitions=function(){return H("transition")},r.fontface=function(){var a;return x('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},r.generatedcontent=function(){var a;return x(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a};for(var I in r)A(r,I)&&(w=I.toLowerCase(),e[w]=r[I](),u.push((e[w]?"":"no-")+w));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)A(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},B(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.hasEvent=y,e.testProp=function(a){return F([a])},e.testAllProps=H,e.testStyles=x,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+u.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f>> 0
+ if ( typeof callback != 'function' ) throw new TypeError()
+ var newArray = [], thisp = arguments[ 1 ]
+ for ( var i = 0; i < len; i++ ) {
+ if ( i in t ) {
+ var val = t[ i ]
+ if ( callback.call( thisp, val, i, t ) ) newArray.push( val )
+ }
+ }
+ return newArray
+ }
+}
+
+
+// Index of array support
+if ( ![].indexOf ) {
+ Array.prototype.indexOf = function( searchElement ) {
+ if ( this == null ) throw new TypeError()
+ var t = Object( this ), len = t.length >>> 0
+ if ( len === 0 ) return -1
+ var n = 0
+ if ( arguments.length > 1 ) {
+ n = Number( arguments[ 1 ] )
+ if ( n != n ) {
+ n = 0
+ }
+ else if ( n !== 0 && n != Infinity && n != -Infinity ) {
+ n = ( n > 0 || -1 ) * Math.floor( Math.abs( n ) )
+ }
+ }
+ if ( n >= len ) return -1
+ var k = n >= 0 ? n : Math.max( len - Math.abs( n ), 0 )
+ for ( ; k < len; k++ ) {
+ if ( k in t && t[ k ] === searchElement ) return k
+ }
+ return -1
+ }
+}
+
+
+/*!
+ * Cross-Browser Split 1.1.1
+ * Copyright 2007-2012 Steven Levithan
+ * Available under the MIT License
+ * http://blog.stevenlevithan.com/archives/cross-browser-split
+ */
+var nativeSplit = String.prototype.split, compliantExecNpcg = /()??/.exec('')[1] === undefined
+String.prototype.split = function(separator, limit) {
+ var str = this
+ if (Object.prototype.toString.call(separator) !== '[object RegExp]') {
+ return nativeSplit.call(str, separator, limit)
+ }
+ var output = [],
+ flags = (separator.ignoreCase ? 'i' : '') +
+ (separator.multiline ? 'm' : '') +
+ (separator.extended ? 'x' : '') +
+ (separator.sticky ? 'y' : ''),
+ lastLastIndex = 0,
+ separator2, match, lastIndex, lastLength
+ separator = new RegExp(separator.source, flags + 'g')
+ str += ''
+ if (!compliantExecNpcg) {
+ separator2 = new RegExp('^' + separator.source + '$(?!\\s)', flags)
+ }
+ limit = limit === undefined ? -1 >>> 0 : limit >>> 0
+ while (match = separator.exec(str)) {
+ lastIndex = match.index + match[0].length
+ if (lastIndex > lastLastIndex) {
+ output.push(str.slice(lastLastIndex, match.index))
+ if (!compliantExecNpcg && match.length > 1) {
+ match[0].replace(separator2, function () {
+ for (var i = 1; i < arguments.length - 2; i++) {
+ if (arguments[i] === undefined) {
+ match[i] = undefined
+ }
+ }
+ })
+ }
+ if (match.length > 1 && match.index < str.length) {
+ Array.prototype.push.apply(output, match.slice(1))
+ }
+ lastLength = match[0].length
+ lastLastIndex = lastIndex
+ if (output.length >= limit) {
+ break
+ }
+ }
+ if (separator.lastIndex === match.index) {
+ separator.lastIndex++
+ }
+ }
+ if (lastLastIndex === str.length) {
+ if (lastLength || !separator.test('')) {
+ output.push('')
+ }
+ } else {
+ output.push(str.slice(lastLastIndex))
+ }
+ return output.length > limit ? output.slice(0, limit) : output
+}
diff --git a/vendor/assets/javascripts/pickadate/picker.date.js b/vendor/assets/javascripts/pickadate/picker.date.js
new file mode 100644
index 00000000..b34e8739
--- /dev/null
+++ b/vendor/assets/javascripts/pickadate/picker.date.js
@@ -0,0 +1,1354 @@
+/*!
+ * Date picker for pickadate.js v3.5.6
+ * http://amsul.github.io/pickadate.js/date.htm
+ */
+
+(function ( factory ) {
+
+ // AMD.
+ if ( typeof define == 'function' && define.amd )
+ define( ['picker', 'jquery'], factory )
+
+ // Node.js/browserify.
+ else if ( typeof exports == 'object' )
+ module.exports = factory( require('./picker.js'), require('jquery') )
+
+ // Browser globals.
+ else factory( Picker, jQuery )
+
+}(function( Picker, $ ) {
+
+
+/**
+ * Globals and constants
+ */
+var DAYS_IN_WEEK = 7,
+ WEEKS_IN_CALENDAR = 6,
+ _ = Picker._
+
+
+
+/**
+ * The date picker constructor
+ */
+function DatePicker( picker, settings ) {
+
+ var calendar = this,
+ element = picker.$node[ 0 ],
+ elementValue = element.value,
+ elementDataValue = picker.$node.data( 'value' ),
+ valueString = elementDataValue || elementValue,
+ formatString = elementDataValue ? settings.formatSubmit : settings.format,
+ isRTL = function() {
+
+ return element.currentStyle ?
+
+ // For IE.
+ element.currentStyle.direction == 'rtl' :
+
+ // For normal browsers.
+ getComputedStyle( picker.$root[0] ).direction == 'rtl'
+ }
+
+ calendar.settings = settings
+ calendar.$node = picker.$node
+
+ // The queue of methods that will be used to build item objects.
+ calendar.queue = {
+ min: 'measure create',
+ max: 'measure create',
+ now: 'now create',
+ select: 'parse create validate',
+ highlight: 'parse navigate create validate',
+ view: 'parse create validate viewset',
+ disable: 'deactivate',
+ enable: 'activate'
+ }
+
+ // The component's item object.
+ calendar.item = {}
+
+ calendar.item.clear = null
+ calendar.item.disable = ( settings.disable || [] ).slice( 0 )
+ calendar.item.enable = -(function( collectionDisabled ) {
+ return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1
+ })( calendar.item.disable )
+
+ calendar.
+ set( 'min', settings.min ).
+ set( 'max', settings.max ).
+ set( 'now' )
+
+ // When there’s a value, set the `select`, which in turn
+ // also sets the `highlight` and `view`.
+ if ( valueString ) {
+ calendar.set( 'select', valueString, {
+ format: formatString,
+ defaultValue: true
+ })
+ }
+
+ // If there’s no value, default to highlighting “today”.
+ else {
+ calendar.
+ set( 'select', null ).
+ set( 'highlight', calendar.item.now )
+ }
+
+
+ // The keycode to movement mapping.
+ calendar.key = {
+ 40: 7, // Down
+ 38: -7, // Up
+ 39: function() { return isRTL() ? -1 : 1 }, // Right
+ 37: function() { return isRTL() ? 1 : -1 }, // Left
+ go: function( timeChange ) {
+ var highlightedObject = calendar.item.highlight,
+ targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )
+ calendar.set(
+ 'highlight',
+ targetDate,
+ { interval: timeChange }
+ )
+ this.render()
+ }
+ }
+
+
+ // Bind some picker events.
+ picker.
+ on( 'render', function() {
+ picker.$root.find( '.' + settings.klass.selectMonth ).on( 'change', function() {
+ var value = this.value
+ if ( value ) {
+ picker.set( 'highlight', [ picker.get( 'view' ).year, value, picker.get( 'highlight' ).date ] )
+ picker.$root.find( '.' + settings.klass.selectMonth ).trigger( 'focus' )
+ }
+ })
+ picker.$root.find( '.' + settings.klass.selectYear ).on( 'change', function() {
+ var value = this.value
+ if ( value ) {
+ picker.set( 'highlight', [ value, picker.get( 'view' ).month, picker.get( 'highlight' ).date ] )
+ picker.$root.find( '.' + settings.klass.selectYear ).trigger( 'focus' )
+ }
+ })
+ }, 1 ).
+ on( 'open', function() {
+ var includeToday = ''
+ if ( calendar.disabled( calendar.get('now') ) ) {
+ includeToday = ':not(.' + settings.klass.buttonToday + ')'
+ }
+ picker.$root.find( 'button' + includeToday + ', select' ).attr( 'disabled', false )
+ }, 1 ).
+ on( 'close', function() {
+ picker.$root.find( 'button, select' ).attr( 'disabled', true )
+ }, 1 )
+
+} //DatePicker
+
+
+/**
+ * Set a datepicker item object.
+ */
+DatePicker.prototype.set = function( type, value, options ) {
+
+ var calendar = this,
+ calendarItem = calendar.item
+
+ // If the value is `null` just set it immediately.
+ if ( value === null ) {
+ if ( type == 'clear' ) type = 'select'
+ calendarItem[ type ] = value
+ return calendar
+ }
+
+ // Otherwise go through the queue of methods, and invoke the functions.
+ // Update this as the time unit, and set the final value as this item.
+ // * In the case of `enable`, keep the queue but set `disable` instead.
+ // And in the case of `flip`, keep the queue but set `enable` instead.
+ calendarItem[ ( type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type ) ] = calendar.queue[ type ].split( ' ' ).map( function( method ) {
+ value = calendar[ method ]( type, value, options )
+ return value
+ }).pop()
+
+ // Check if we need to cascade through more updates.
+ if ( type == 'select' ) {
+ calendar.set( 'highlight', calendarItem.select, options )
+ }
+ else if ( type == 'highlight' ) {
+ calendar.set( 'view', calendarItem.highlight, options )
+ }
+ else if ( type.match( /^(flip|min|max|disable|enable)$/ ) ) {
+ if ( calendarItem.select && calendar.disabled( calendarItem.select ) ) {
+ calendar.set( 'select', calendarItem.select, options )
+ }
+ if ( calendarItem.highlight && calendar.disabled( calendarItem.highlight ) ) {
+ calendar.set( 'highlight', calendarItem.highlight, options )
+ }
+ }
+
+ return calendar
+} //DatePicker.prototype.set
+
+
+/**
+ * Get a datepicker item object.
+ */
+DatePicker.prototype.get = function( type ) {
+ return this.item[ type ]
+} //DatePicker.prototype.get
+
+
+/**
+ * Create a picker date object.
+ */
+DatePicker.prototype.create = function( type, value, options ) {
+
+ var isInfiniteValue,
+ calendar = this
+
+ // If there’s no value, use the type as the value.
+ value = value === undefined ? type : value
+
+
+ // If it’s infinity, update the value.
+ if ( value == -Infinity || value == Infinity ) {
+ isInfiniteValue = value
+ }
+
+ // If it’s an object, use the native date object.
+ else if ( $.isPlainObject( value ) && _.isInteger( value.pick ) ) {
+ value = value.obj
+ }
+
+ // If it’s an array, convert it into a date and make sure
+ // that it’s a valid date – otherwise default to today.
+ else if ( $.isArray( value ) ) {
+ value = new Date( value[ 0 ], value[ 1 ], value[ 2 ] )
+ value = _.isDate( value ) ? value : calendar.create().obj
+ }
+
+ // If it’s a number or date object, make a normalized date.
+ else if ( _.isInteger( value ) || _.isDate( value ) ) {
+ value = calendar.normalize( new Date( value ), options )
+ }
+
+ // If it’s a literal true or any other case, set it to now.
+ else /*if ( value === true )*/ {
+ value = calendar.now( type, value, options )
+ }
+
+ // Return the compiled object.
+ return {
+ year: isInfiniteValue || value.getFullYear(),
+ month: isInfiniteValue || value.getMonth(),
+ date: isInfiniteValue || value.getDate(),
+ day: isInfiniteValue || value.getDay(),
+ obj: isInfiniteValue || value,
+ pick: isInfiniteValue || value.getTime()
+ }
+} //DatePicker.prototype.create
+
+
+/**
+ * Create a range limit object using an array, date object,
+ * literal “true”, or integer relative to another time.
+ */
+DatePicker.prototype.createRange = function( from, to ) {
+
+ var calendar = this,
+ createDate = function( date ) {
+ if ( date === true || $.isArray( date ) || _.isDate( date ) ) {
+ return calendar.create( date )
+ }
+ return date
+ }
+
+ // Create objects if possible.
+ if ( !_.isInteger( from ) ) {
+ from = createDate( from )
+ }
+ if ( !_.isInteger( to ) ) {
+ to = createDate( to )
+ }
+
+ // Create relative dates.
+ if ( _.isInteger( from ) && $.isPlainObject( to ) ) {
+ from = [ to.year, to.month, to.date + from ];
+ }
+ else if ( _.isInteger( to ) && $.isPlainObject( from ) ) {
+ to = [ from.year, from.month, from.date + to ];
+ }
+
+ return {
+ from: createDate( from ),
+ to: createDate( to )
+ }
+} //DatePicker.prototype.createRange
+
+
+/**
+ * Check if a date unit falls within a date range object.
+ */
+DatePicker.prototype.withinRange = function( range, dateUnit ) {
+ range = this.createRange(range.from, range.to)
+ return dateUnit.pick >= range.from.pick && dateUnit.pick <= range.to.pick
+}
+
+
+/**
+ * Check if two date range objects overlap.
+ */
+DatePicker.prototype.overlapRanges = function( one, two ) {
+
+ var calendar = this
+
+ // Convert the ranges into comparable dates.
+ one = calendar.createRange( one.from, one.to )
+ two = calendar.createRange( two.from, two.to )
+
+ return calendar.withinRange( one, two.from ) || calendar.withinRange( one, two.to ) ||
+ calendar.withinRange( two, one.from ) || calendar.withinRange( two, one.to )
+}
+
+
+/**
+ * Get the date today.
+ */
+DatePicker.prototype.now = function( type, value, options ) {
+ value = new Date()
+ if ( options && options.rel ) {
+ value.setDate( value.getDate() + options.rel )
+ }
+ return this.normalize( value, options )
+}
+
+
+/**
+ * Navigate to next/prev month.
+ */
+DatePicker.prototype.navigate = function( type, value, options ) {
+
+ var targetDateObject,
+ targetYear,
+ targetMonth,
+ targetDate,
+ isTargetArray = $.isArray( value ),
+ isTargetObject = $.isPlainObject( value ),
+ viewsetObject = this.item.view/*,
+ safety = 100*/
+
+
+ if ( isTargetArray || isTargetObject ) {
+
+ if ( isTargetObject ) {
+ targetYear = value.year
+ targetMonth = value.month
+ targetDate = value.date
+ }
+ else {
+ targetYear = +value[0]
+ targetMonth = +value[1]
+ targetDate = +value[2]
+ }
+
+ // If we’re navigating months but the view is in a different
+ // month, navigate to the view’s year and month.
+ if ( options && options.nav && viewsetObject && viewsetObject.month !== targetMonth ) {
+ targetYear = viewsetObject.year
+ targetMonth = viewsetObject.month
+ }
+
+ // Figure out the expected target year and month.
+ targetDateObject = new Date( targetYear, targetMonth + ( options && options.nav ? options.nav : 0 ), 1 )
+ targetYear = targetDateObject.getFullYear()
+ targetMonth = targetDateObject.getMonth()
+
+ // If the month we’re going to doesn’t have enough days,
+ // keep decreasing the date until we reach the month’s last date.
+ while ( /*safety &&*/ new Date( targetYear, targetMonth, targetDate ).getMonth() !== targetMonth ) {
+ targetDate -= 1
+ /*safety -= 1
+ if ( !safety ) {
+ throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
+ }*/
+ }
+
+ value = [ targetYear, targetMonth, targetDate ]
+ }
+
+ return value
+} //DatePicker.prototype.navigate
+
+
+/**
+ * Normalize a date by setting the hours to midnight.
+ */
+DatePicker.prototype.normalize = function( value/*, options*/ ) {
+ value.setHours( 0, 0, 0, 0 )
+ return value
+}
+
+
+/**
+ * Measure the range of dates.
+ */
+DatePicker.prototype.measure = function( type, value/*, options*/ ) {
+
+ var calendar = this
+
+ // If it’s anything false-y, remove the limits.
+ if ( !value ) {
+ value = type == 'min' ? -Infinity : Infinity
+ }
+
+ // If it’s a string, parse it.
+ else if ( typeof value == 'string' ) {
+ value = calendar.parse( type, value )
+ }
+
+ // If it's an integer, get a date relative to today.
+ else if ( _.isInteger( value ) ) {
+ value = calendar.now( type, value, { rel: value } )
+ }
+
+ return value
+} ///DatePicker.prototype.measure
+
+
+/**
+ * Create a viewset object based on navigation.
+ */
+DatePicker.prototype.viewset = function( type, dateObject/*, options*/ ) {
+ return this.create([ dateObject.year, dateObject.month, 1 ])
+}
+
+
+/**
+ * Validate a date as enabled and shift if needed.
+ */
+DatePicker.prototype.validate = function( type, dateObject, options ) {
+
+ var calendar = this,
+
+ // Keep a reference to the original date.
+ originalDateObject = dateObject,
+
+ // Make sure we have an interval.
+ interval = options && options.interval ? options.interval : 1,
+
+ // Check if the calendar enabled dates are inverted.
+ isFlippedBase = calendar.item.enable === -1,
+
+ // Check if we have any enabled dates after/before now.
+ hasEnabledBeforeTarget, hasEnabledAfterTarget,
+
+ // The min & max limits.
+ minLimitObject = calendar.item.min,
+ maxLimitObject = calendar.item.max,
+
+ // Check if we’ve reached the limit during shifting.
+ reachedMin, reachedMax,
+
+ // Check if the calendar is inverted and at least one weekday is enabled.
+ hasEnabledWeekdays = isFlippedBase && calendar.item.disable.filter( function( value ) {
+
+ // If there’s a date, check where it is relative to the target.
+ if ( $.isArray( value ) ) {
+ var dateTime = calendar.create( value ).pick
+ if ( dateTime < dateObject.pick ) hasEnabledBeforeTarget = true
+ else if ( dateTime > dateObject.pick ) hasEnabledAfterTarget = true
+ }
+
+ // Return only integers for enabled weekdays.
+ return _.isInteger( value )
+ }).length/*,
+
+ safety = 100*/
+
+
+
+ // Cases to validate for:
+ // [1] Not inverted and date disabled.
+ // [2] Inverted and some dates enabled.
+ // [3] Not inverted and out of range.
+ //
+ // Cases to **not** validate for:
+ // • Navigating months.
+ // • Not inverted and date enabled.
+ // • Inverted and all dates disabled.
+ // • ..and anything else.
+ if ( !options || (!options.nav && !options.defaultValue) ) if (
+ /* 1 */ ( !isFlippedBase && calendar.disabled( dateObject ) ) ||
+ /* 2 */ ( isFlippedBase && calendar.disabled( dateObject ) && ( hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget ) ) ||
+ /* 3 */ ( !isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick) )
+ ) {
+
+
+ // When inverted, flip the direction if there aren’t any enabled weekdays
+ // and there are no enabled dates in the direction of the interval.
+ if ( isFlippedBase && !hasEnabledWeekdays && ( ( !hasEnabledAfterTarget && interval > 0 ) || ( !hasEnabledBeforeTarget && interval < 0 ) ) ) {
+ interval *= -1
+ }
+
+
+ // Keep looping until we reach an enabled date.
+ while ( /*safety &&*/ calendar.disabled( dateObject ) ) {
+
+ /*safety -= 1
+ if ( !safety ) {
+ throw 'Fell into an infinite loop while validating ' + dateObject.obj + '.'
+ }*/
+
+
+ // If we’ve looped into the next/prev month with a large interval, return to the original date and flatten the interval.
+ if ( Math.abs( interval ) > 1 && ( dateObject.month < originalDateObject.month || dateObject.month > originalDateObject.month ) ) {
+ dateObject = originalDateObject
+ interval = interval > 0 ? 1 : -1
+ }
+
+
+ // If we’ve reached the min/max limit, reverse the direction, flatten the interval and set it to the limit.
+ if ( dateObject.pick <= minLimitObject.pick ) {
+ reachedMin = true
+ interval = 1
+ dateObject = calendar.create([
+ minLimitObject.year,
+ minLimitObject.month,
+ minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)
+ ])
+ }
+ else if ( dateObject.pick >= maxLimitObject.pick ) {
+ reachedMax = true
+ interval = -1
+ dateObject = calendar.create([
+ maxLimitObject.year,
+ maxLimitObject.month,
+ maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)
+ ])
+ }
+
+
+ // If we’ve reached both limits, just break out of the loop.
+ if ( reachedMin && reachedMax ) {
+ break
+ }
+
+
+ // Finally, create the shifted date using the interval and keep looping.
+ dateObject = calendar.create([ dateObject.year, dateObject.month, dateObject.date + interval ])
+ }
+
+ } //endif
+
+
+ // Return the date object settled on.
+ return dateObject
+} //DatePicker.prototype.validate
+
+
+/**
+ * Check if a date is disabled.
+ */
+DatePicker.prototype.disabled = function( dateToVerify ) {
+
+ var
+ calendar = this,
+
+ // Filter through the disabled dates to check if this is one.
+ isDisabledMatch = calendar.item.disable.filter( function( dateToDisable ) {
+
+ // If the date is a number, match the weekday with 0index and `firstDay` check.
+ if ( _.isInteger( dateToDisable ) ) {
+ return dateToVerify.day === ( calendar.settings.firstDay ? dateToDisable : dateToDisable - 1 ) % 7
+ }
+
+ // If it’s an array or a native JS date, create and match the exact date.
+ if ( $.isArray( dateToDisable ) || _.isDate( dateToDisable ) ) {
+ return dateToVerify.pick === calendar.create( dateToDisable ).pick
+ }
+
+ // If it’s an object, match a date within the “from” and “to” range.
+ if ( $.isPlainObject( dateToDisable ) ) {
+ return calendar.withinRange( dateToDisable, dateToVerify )
+ }
+ })
+
+ // If this date matches a disabled date, confirm it’s not inverted.
+ isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function( dateToDisable ) {
+ return $.isArray( dateToDisable ) && dateToDisable[3] == 'inverted' ||
+ $.isPlainObject( dateToDisable ) && dateToDisable.inverted
+ }).length
+
+ // Check the calendar “enabled” flag and respectively flip the
+ // disabled state. Then also check if it’s beyond the min/max limits.
+ return calendar.item.enable === -1 ? !isDisabledMatch : isDisabledMatch ||
+ dateToVerify.pick < calendar.item.min.pick ||
+ dateToVerify.pick > calendar.item.max.pick
+
+} //DatePicker.prototype.disabled
+
+
+/**
+ * Parse a string into a usable type.
+ */
+DatePicker.prototype.parse = function( type, value, options ) {
+
+ var calendar = this,
+ parsingObject = {}
+
+ // If it’s already parsed, we’re good.
+ if ( !value || typeof value != 'string' ) {
+ return value
+ }
+
+ // We need a `.format` to parse the value with.
+ if ( !( options && options.format ) ) {
+ options = options || {}
+ options.format = calendar.settings.format
+ }
+
+ // Convert the format into an array and then map through it.
+ calendar.formats.toArray( options.format ).map( function( label ) {
+
+ var
+ // Grab the formatting label.
+ formattingLabel = calendar.formats[ label ],
+
+ // The format length is from the formatting label function or the
+ // label length without the escaping exclamation (!) mark.
+ formatLength = formattingLabel ? _.trigger( formattingLabel, calendar, [ value, parsingObject ] ) : label.replace( /^!/, '' ).length
+
+ // If there's a format label, split the value up to the format length.
+ // Then add it to the parsing object with appropriate label.
+ if ( formattingLabel ) {
+ parsingObject[ label ] = value.substr( 0, formatLength )
+ }
+
+ // Update the value as the substring from format length to end.
+ value = value.substr( formatLength )
+ })
+
+ // Compensate for month 0index.
+ return [
+ parsingObject.yyyy || parsingObject.yy,
+ +( parsingObject.mm || parsingObject.m ) - 1,
+ parsingObject.dd || parsingObject.d
+ ]
+} //DatePicker.prototype.parse
+
+
+/**
+ * Various formats to display the object in.
+ */
+DatePicker.prototype.formats = (function() {
+
+ // Return the length of the first word in a collection.
+ function getWordLengthFromCollection( string, collection, dateObject ) {
+
+ // Grab the first word from the string.
+ // Regex pattern from http://stackoverflow.com/q/150033
+ var word = string.match( /[^\x00-\x7F]+|\w+/ )[ 0 ]
+
+ // If there's no month index, add it to the date object
+ if ( !dateObject.mm && !dateObject.m ) {
+ dateObject.m = collection.indexOf( word ) + 1
+ }
+
+ // Return the length of the word.
+ return word.length
+ }
+
+ // Get the length of the first word in a string.
+ function getFirstWordLength( string ) {
+ return string.match( /\w+/ )[ 0 ].length
+ }
+
+ return {
+
+ d: function( string, dateObject ) {
+
+ // If there's string, then get the digits length.
+ // Otherwise return the selected date.
+ return string ? _.digits( string ) : dateObject.date
+ },
+ dd: function( string, dateObject ) {
+
+ // If there's a string, then the length is always 2.
+ // Otherwise return the selected date with a leading zero.
+ return string ? 2 : _.lead( dateObject.date )
+ },
+ ddd: function( string, dateObject ) {
+
+ // If there's a string, then get the length of the first word.
+ // Otherwise return the short selected weekday.
+ return string ? getFirstWordLength( string ) : this.settings.weekdaysShort[ dateObject.day ]
+ },
+ dddd: function( string, dateObject ) {
+
+ // If there's a string, then get the length of the first word.
+ // Otherwise return the full selected weekday.
+ return string ? getFirstWordLength( string ) : this.settings.weekdaysFull[ dateObject.day ]
+ },
+ m: function( string, dateObject ) {
+
+ // If there's a string, then get the length of the digits
+ // Otherwise return the selected month with 0index compensation.
+ return string ? _.digits( string ) : dateObject.month + 1
+ },
+ mm: function( string, dateObject ) {
+
+ // If there's a string, then the length is always 2.
+ // Otherwise return the selected month with 0index and leading zero.
+ return string ? 2 : _.lead( dateObject.month + 1 )
+ },
+ mmm: function( string, dateObject ) {
+
+ var collection = this.settings.monthsShort
+
+ // If there's a string, get length of the relevant month from the short
+ // months collection. Otherwise return the selected month from that collection.
+ return string ? getWordLengthFromCollection( string, collection, dateObject ) : collection[ dateObject.month ]
+ },
+ mmmm: function( string, dateObject ) {
+
+ var collection = this.settings.monthsFull
+
+ // If there's a string, get length of the relevant month from the full
+ // months collection. Otherwise return the selected month from that collection.
+ return string ? getWordLengthFromCollection( string, collection, dateObject ) : collection[ dateObject.month ]
+ },
+ yy: function( string, dateObject ) {
+
+ // If there's a string, then the length is always 2.
+ // Otherwise return the selected year by slicing out the first 2 digits.
+ return string ? 2 : ( '' + dateObject.year ).slice( 2 )
+ },
+ yyyy: function( string, dateObject ) {
+
+ // If there's a string, then the length is always 4.
+ // Otherwise return the selected year.
+ return string ? 4 : dateObject.year
+ },
+
+ // Create an array by splitting the formatting string passed.
+ toArray: function( formatString ) { return formatString.split( /(d{1,4}|m{1,4}|y{4}|yy|!.)/g ) },
+
+ // Format an object into a string using the formatting options.
+ toString: function ( formatString, itemObject ) {
+ var calendar = this
+ return calendar.formats.toArray( formatString ).map( function( label ) {
+ return _.trigger( calendar.formats[ label ], calendar, [ 0, itemObject ] ) || label.replace( /^!/, '' )
+ }).join( '' )
+ }
+ }
+})() //DatePicker.prototype.formats
+
+
+
+
+/**
+ * Check if two date units are the exact.
+ */
+DatePicker.prototype.isDateExact = function( one, two ) {
+
+ var calendar = this
+
+ // When we’re working with weekdays, do a direct comparison.
+ if (
+ ( _.isInteger( one ) && _.isInteger( two ) ) ||
+ ( typeof one == 'boolean' && typeof two == 'boolean' )
+ ) {
+ return one === two
+ }
+
+ // When we’re working with date representations, compare the “pick” value.
+ if (
+ ( _.isDate( one ) || $.isArray( one ) ) &&
+ ( _.isDate( two ) || $.isArray( two ) )
+ ) {
+ return calendar.create( one ).pick === calendar.create( two ).pick
+ }
+
+ // When we’re working with range objects, compare the “from” and “to”.
+ if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) {
+ return calendar.isDateExact( one.from, two.from ) && calendar.isDateExact( one.to, two.to )
+ }
+
+ return false
+}
+
+
+/**
+ * Check if two date units overlap.
+ */
+DatePicker.prototype.isDateOverlap = function( one, two ) {
+
+ var calendar = this,
+ firstDay = calendar.settings.firstDay ? 1 : 0
+
+ // When we’re working with a weekday index, compare the days.
+ if ( _.isInteger( one ) && ( _.isDate( two ) || $.isArray( two ) ) ) {
+ one = one % 7 + firstDay
+ return one === calendar.create( two ).day + 1
+ }
+ if ( _.isInteger( two ) && ( _.isDate( one ) || $.isArray( one ) ) ) {
+ two = two % 7 + firstDay
+ return two === calendar.create( one ).day + 1
+ }
+
+ // When we’re working with range objects, check if the ranges overlap.
+ if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) {
+ return calendar.overlapRanges( one, two )
+ }
+
+ return false
+}
+
+
+/**
+ * Flip the “enabled” state.
+ */
+DatePicker.prototype.flipEnable = function(val) {
+ var itemObject = this.item
+ itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1)
+}
+
+
+/**
+ * Mark a collection of dates as “disabled”.
+ */
+DatePicker.prototype.deactivate = function( type, datesToDisable ) {
+
+ var calendar = this,
+ disabledItems = calendar.item.disable.slice(0)
+
+
+ // If we’re flipping, that’s all we need to do.
+ if ( datesToDisable == 'flip' ) {
+ calendar.flipEnable()
+ }
+
+ else if ( datesToDisable === false ) {
+ calendar.flipEnable(1)
+ disabledItems = []
+ }
+
+ else if ( datesToDisable === true ) {
+ calendar.flipEnable(-1)
+ disabledItems = []
+ }
+
+ // Otherwise go through the dates to disable.
+ else {
+
+ datesToDisable.map(function( unitToDisable ) {
+
+ var matchFound
+
+ // When we have disabled items, check for matches.
+ // If something is matched, immediately break out.
+ for ( var index = 0; index < disabledItems.length; index += 1 ) {
+ if ( calendar.isDateExact( unitToDisable, disabledItems[index] ) ) {
+ matchFound = true
+ break
+ }
+ }
+
+ // If nothing was found, add the validated unit to the collection.
+ if ( !matchFound ) {
+ if (
+ _.isInteger( unitToDisable ) ||
+ _.isDate( unitToDisable ) ||
+ $.isArray( unitToDisable ) ||
+ ( $.isPlainObject( unitToDisable ) && unitToDisable.from && unitToDisable.to )
+ ) {
+ disabledItems.push( unitToDisable )
+ }
+ }
+ })
+ }
+
+ // Return the updated collection.
+ return disabledItems
+} //DatePicker.prototype.deactivate
+
+
+/**
+ * Mark a collection of dates as “enabled”.
+ */
+DatePicker.prototype.activate = function( type, datesToEnable ) {
+
+ var calendar = this,
+ disabledItems = calendar.item.disable,
+ disabledItemsCount = disabledItems.length
+
+ // If we’re flipping, that’s all we need to do.
+ if ( datesToEnable == 'flip' ) {
+ calendar.flipEnable()
+ }
+
+ else if ( datesToEnable === true ) {
+ calendar.flipEnable(1)
+ disabledItems = []
+ }
+
+ else if ( datesToEnable === false ) {
+ calendar.flipEnable(-1)
+ disabledItems = []
+ }
+
+ // Otherwise go through the disabled dates.
+ else {
+
+ datesToEnable.map(function( unitToEnable ) {
+
+ var matchFound,
+ disabledUnit,
+ index,
+ isExactRange
+
+ // Go through the disabled items and try to find a match.
+ for ( index = 0; index < disabledItemsCount; index += 1 ) {
+
+ disabledUnit = disabledItems[index]
+
+ // When an exact match is found, remove it from the collection.
+ if ( calendar.isDateExact( disabledUnit, unitToEnable ) ) {
+ matchFound = disabledItems[index] = null
+ isExactRange = true
+ break
+ }
+
+ // When an overlapped match is found, add the “inverted” state to it.
+ else if ( calendar.isDateOverlap( disabledUnit, unitToEnable ) ) {
+ if ( $.isPlainObject( unitToEnable ) ) {
+ unitToEnable.inverted = true
+ matchFound = unitToEnable
+ }
+ else if ( $.isArray( unitToEnable ) ) {
+ matchFound = unitToEnable
+ if ( !matchFound[3] ) matchFound.push( 'inverted' )
+ }
+ else if ( _.isDate( unitToEnable ) ) {
+ matchFound = [ unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted' ]
+ }
+ break
+ }
+ }
+
+ // If a match was found, remove a previous duplicate entry.
+ if ( matchFound ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
+ if ( calendar.isDateExact( disabledItems[index], unitToEnable ) ) {
+ disabledItems[index] = null
+ break
+ }
+ }
+
+ // In the event that we’re dealing with an exact range of dates,
+ // make sure there are no “inverted” dates because of it.
+ if ( isExactRange ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
+ if ( calendar.isDateOverlap( disabledItems[index], unitToEnable ) ) {
+ disabledItems[index] = null
+ break
+ }
+ }
+
+ // If something is still matched, add it into the collection.
+ if ( matchFound ) {
+ disabledItems.push( matchFound )
+ }
+ })
+ }
+
+ // Return the updated collection.
+ return disabledItems.filter(function( val ) { return val != null })
+} //DatePicker.prototype.activate
+
+
+/**
+ * Create a string for the nodes in the picker.
+ */
+DatePicker.prototype.nodes = function( isOpen ) {
+
+ var
+ calendar = this,
+ settings = calendar.settings,
+ calendarItem = calendar.item,
+ nowObject = calendarItem.now,
+ selectedObject = calendarItem.select,
+ highlightedObject = calendarItem.highlight,
+ viewsetObject = calendarItem.view,
+ disabledCollection = calendarItem.disable,
+ minLimitObject = calendarItem.min,
+ maxLimitObject = calendarItem.max,
+
+
+ // Create the calendar table head using a copy of weekday labels collection.
+ // * We do a copy so we don't mutate the original array.
+ tableHead = (function( collection, fullCollection ) {
+
+ // If the first day should be Monday, move Sunday to the end.
+ if ( settings.firstDay ) {
+ collection.push( collection.shift() )
+ fullCollection.push( fullCollection.shift() )
+ }
+
+ // Create and return the table head group.
+ return _.node(
+ 'thead',
+ _.node(
+ 'tr',
+ _.group({
+ min: 0,
+ max: DAYS_IN_WEEK - 1,
+ i: 1,
+ node: 'th',
+ item: function( counter ) {
+ return [
+ collection[ counter ],
+ settings.klass.weekdays,
+ 'scope=col title="' + fullCollection[ counter ] + '"'
+ ]
+ }
+ })
+ )
+ ) //endreturn
+ })( ( settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysShort ).slice( 0 ), settings.weekdaysFull.slice( 0 ) ), //tableHead
+
+
+ // Create the nav for next/prev month.
+ createMonthNav = function( next ) {
+
+ // Otherwise, return the created month tag.
+ return _.node(
+ 'div',
+ ' ',
+ settings.klass[ 'nav' + ( next ? 'Next' : 'Prev' ) ] + (
+
+ // If the focused month is outside the range, disabled the button.
+ ( next && viewsetObject.year >= maxLimitObject.year && viewsetObject.month >= maxLimitObject.month ) ||
+ ( !next && viewsetObject.year <= minLimitObject.year && viewsetObject.month <= minLimitObject.month ) ?
+ ' ' + settings.klass.navDisabled : ''
+ ),
+ 'data-nav=' + ( next || -1 ) + ' ' +
+ _.ariaAttr({
+ role: 'button',
+ controls: calendar.$node[0].id + '_table'
+ }) + ' ' +
+ 'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev ) + '"'
+ ) //endreturn
+ }, //createMonthNav
+
+
+ // Create the month label.
+ createMonthLabel = function() {
+
+ var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull
+
+ // If there are months to select, add a dropdown menu.
+ if ( settings.selectMonths ) {
+
+ return _.node( 'select',
+ _.group({
+ min: 0,
+ max: 11,
+ i: 1,
+ node: 'option',
+ item: function( loopedMonth ) {
+
+ return [
+
+ // The looped month and no classes.
+ monthsCollection[ loopedMonth ], 0,
+
+ // Set the value and selected index.
+ 'value=' + loopedMonth +
+ ( viewsetObject.month == loopedMonth ? ' selected' : '' ) +
+ (
+ (
+ ( viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month ) ||
+ ( viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month )
+ ) ?
+ ' disabled' : ''
+ )
+ ]
+ }
+ }),
+ settings.klass.selectMonth,
+ ( isOpen ? '' : 'disabled' ) + ' ' +
+ _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
+ 'title="' + settings.labelMonthSelect + '"'
+ )
+ }
+
+ // If there's a need for a month selector
+ return _.node( 'div', monthsCollection[ viewsetObject.month ], settings.klass.month )
+ }, //createMonthLabel
+
+
+ // Create the year label.
+ createYearLabel = function() {
+
+ var focusedYear = viewsetObject.year,
+
+ // If years selector is set to a literal "true", set it to 5. Otherwise
+ // divide in half to get half before and half after focused year.
+ numberYears = settings.selectYears === true ? 5 : ~~( settings.selectYears / 2 )
+
+ // If there are years to select, add a dropdown menu.
+ if ( numberYears ) {
+
+ var
+ minYear = minLimitObject.year,
+ maxYear = maxLimitObject.year,
+ lowestYear = focusedYear - numberYears,
+ highestYear = focusedYear + numberYears
+
+ // If the min year is greater than the lowest year, increase the highest year
+ // by the difference and set the lowest year to the min year.
+ if ( minYear > lowestYear ) {
+ highestYear += minYear - lowestYear
+ lowestYear = minYear
+ }
+
+ // If the max year is less than the highest year, decrease the lowest year
+ // by the lower of the two: available and needed years. Then set the
+ // highest year to the max year.
+ if ( maxYear < highestYear ) {
+
+ var availableYears = lowestYear - minYear,
+ neededYears = highestYear - maxYear
+
+ lowestYear -= availableYears > neededYears ? neededYears : availableYears
+ highestYear = maxYear
+ }
+
+ return _.node( 'select',
+ _.group({
+ min: lowestYear,
+ max: highestYear,
+ i: 1,
+ node: 'option',
+ item: function( loopedYear ) {
+ return [
+
+ // The looped year and no classes.
+ loopedYear, 0,
+
+ // Set the value and selected index.
+ 'value=' + loopedYear + ( focusedYear == loopedYear ? ' selected' : '' )
+ ]
+ }
+ }),
+ settings.klass.selectYear,
+ ( isOpen ? '' : 'disabled' ) + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
+ 'title="' + settings.labelYearSelect + '"'
+ )
+ }
+
+ // Otherwise just return the year focused
+ return _.node( 'div', focusedYear, settings.klass.year )
+ } //createYearLabel
+
+
+ // Create and return the entire calendar.
+ return _.node(
+ 'div',
+ ( settings.selectYears ? createYearLabel() + createMonthLabel() : createMonthLabel() + createYearLabel() ) +
+ createMonthNav() + createMonthNav( 1 ),
+ settings.klass.header
+ ) + _.node(
+ 'table',
+ tableHead +
+ _.node(
+ 'tbody',
+ _.group({
+ min: 0,
+ max: WEEKS_IN_CALENDAR - 1,
+ i: 1,
+ node: 'tr',
+ item: function( rowCounter ) {
+
+ // If Monday is the first day and the month starts on Sunday, shift the date back a week.
+ var shiftDateBy = settings.firstDay && calendar.create([ viewsetObject.year, viewsetObject.month, 1 ]).day === 0 ? -7 : 0
+
+ return [
+ _.group({
+ min: DAYS_IN_WEEK * rowCounter - viewsetObject.day + shiftDateBy + 1, // Add 1 for weekday 0index
+ max: function() {
+ return this.min + DAYS_IN_WEEK - 1
+ },
+ i: 1,
+ node: 'td',
+ item: function( targetDate ) {
+
+ // Convert the time date from a relative date to a target date.
+ targetDate = calendar.create([ viewsetObject.year, viewsetObject.month, targetDate + ( settings.firstDay ? 1 : 0 ) ])
+
+ var isSelected = selectedObject && selectedObject.pick == targetDate.pick,
+ isHighlighted = highlightedObject && highlightedObject.pick == targetDate.pick,
+ isDisabled = disabledCollection && calendar.disabled( targetDate ) || targetDate.pick < minLimitObject.pick || targetDate.pick > maxLimitObject.pick,
+ formattedDate = _.trigger( calendar.formats.toString, calendar, [ settings.format, targetDate ] )
+
+ return [
+ _.node(
+ 'div',
+ targetDate.date,
+ (function( klasses ) {
+
+ // Add the `infocus` or `outfocus` classes based on month in view.
+ klasses.push( viewsetObject.month == targetDate.month ? settings.klass.infocus : settings.klass.outfocus )
+
+ // Add the `today` class if needed.
+ if ( nowObject.pick == targetDate.pick ) {
+ klasses.push( settings.klass.now )
+ }
+
+ // Add the `selected` class if something's selected and the time matches.
+ if ( isSelected ) {
+ klasses.push( settings.klass.selected )
+ }
+
+ // Add the `highlighted` class if something's highlighted and the time matches.
+ if ( isHighlighted ) {
+ klasses.push( settings.klass.highlighted )
+ }
+
+ // Add the `disabled` class if something's disabled and the object matches.
+ if ( isDisabled ) {
+ klasses.push( settings.klass.disabled )
+ }
+
+ return klasses.join( ' ' )
+ })([ settings.klass.day ]),
+ 'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
+ role: 'gridcell',
+ label: formattedDate,
+ selected: isSelected && calendar.$node.val() === formattedDate ? true : null,
+ activedescendant: isHighlighted ? true : null,
+ disabled: isDisabled ? true : null
+ })
+ ),
+ '',
+ _.ariaAttr({ role: 'presentation' })
+ ] //endreturn
+ }
+ })
+ ] //endreturn
+ }
+ })
+ ),
+ settings.klass.table,
+ 'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
+ role: 'grid',
+ controls: calendar.$node[0].id,
+ readonly: true
+ })
+ ) +
+
+ // * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
+ _.node(
+ 'div',
+ _.node( 'button', settings.today, settings.klass.buttonToday,
+ 'type=button data-pick=' + nowObject.pick +
+ ( isOpen && !calendar.disabled(nowObject) ? '' : ' disabled' ) + ' ' +
+ _.ariaAttr({ controls: calendar.$node[0].id }) ) +
+ _.node( 'button', settings.clear, settings.klass.buttonClear,
+ 'type=button data-clear=1' +
+ ( isOpen ? '' : ' disabled' ) + ' ' +
+ _.ariaAttr({ controls: calendar.$node[0].id }) ) +
+ _.node('button', settings.close, settings.klass.buttonClose,
+ 'type=button data-close=true ' +
+ ( isOpen ? '' : ' disabled' ) + ' ' +
+ _.ariaAttr({ controls: calendar.$node[0].id }) ),
+ settings.klass.footer
+ ) //endreturn
+} //DatePicker.prototype.nodes
+
+
+
+
+/**
+ * The date picker defaults.
+ */
+DatePicker.defaults = (function( prefix ) {
+
+ return {
+
+ // The title label to use for the month nav buttons
+ labelMonthNext: 'Next month',
+ labelMonthPrev: 'Previous month',
+
+ // The title label to use for the dropdown selectors
+ labelMonthSelect: 'Select a month',
+ labelYearSelect: 'Select a year',
+
+ // Months and weekdays
+ monthsFull: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],
+ monthsShort: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
+ weekdaysFull: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],
+ weekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
+
+ // Today and clear
+ today: 'Today',
+ clear: 'Clear',
+ close: 'Close',
+
+ // Picker close behavior
+ closeOnSelect: true,
+ closeOnClear: true,
+
+ // The format to show on the `input` element
+ format: 'd mmmm, yyyy',
+
+ // Classes
+ klass: {
+
+ table: prefix + 'table',
+
+ header: prefix + 'header',
+
+ navPrev: prefix + 'nav--prev',
+ navNext: prefix + 'nav--next',
+ navDisabled: prefix + 'nav--disabled',
+
+ month: prefix + 'month',
+ year: prefix + 'year',
+
+ selectMonth: prefix + 'select--month',
+ selectYear: prefix + 'select--year',
+
+ weekdays: prefix + 'weekday',
+
+ day: prefix + 'day',
+ disabled: prefix + 'day--disabled',
+ selected: prefix + 'day--selected',
+ highlighted: prefix + 'day--highlighted',
+ now: prefix + 'day--today',
+ infocus: prefix + 'day--infocus',
+ outfocus: prefix + 'day--outfocus',
+
+ footer: prefix + 'footer',
+
+ buttonClear: prefix + 'button--clear',
+ buttonToday: prefix + 'button--today',
+ buttonClose: prefix + 'button--close'
+ }
+ }
+})( Picker.klasses().picker + '__' )
+
+
+
+
+
+/**
+ * Extend the picker to add the date picker.
+ */
+Picker.extend( 'pickadate', DatePicker )
+
+
+}));
+
+
+
diff --git a/vendor/assets/javascripts/pickadate/picker.js b/vendor/assets/javascripts/pickadate/picker.js
new file mode 100644
index 00000000..27906617
--- /dev/null
+++ b/vendor/assets/javascripts/pickadate/picker.js
@@ -0,0 +1,1163 @@
+/*!
+ * pickadate.js v3.5.6, 2015/04/20
+ * By Amsul, http://amsul.ca
+ * Hosted on http://amsul.github.io/pickadate.js
+ * Licensed under MIT
+ */
+
+(function ( factory ) {
+
+ // AMD.
+ if ( typeof define == 'function' && define.amd )
+ define( 'picker', ['jquery'], factory )
+
+ // Node.js/browserify.
+ else if ( typeof exports == 'object' )
+ module.exports = factory( require('jquery') )
+
+ // Browser globals.
+ else this.Picker = factory( jQuery )
+
+}(function( $ ) {
+
+var $window = $( window )
+var $document = $( document )
+var $html = $( document.documentElement )
+var supportsTransitions = document.documentElement.style.transition != null
+
+
+/**
+ * The picker constructor that creates a blank picker.
+ */
+function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
+
+ // If there’s no element, return the picker constructor.
+ if ( !ELEMENT ) return PickerConstructor
+
+
+ var
+ IS_DEFAULT_THEME = false,
+
+
+ // The state of the picker.
+ STATE = {
+ id: ELEMENT.id || 'P' + Math.abs( ~~(Math.random() * new Date()) )
+ },
+
+
+ // Merge the defaults and options passed.
+ SETTINGS = COMPONENT ? $.extend( true, {}, COMPONENT.defaults, OPTIONS ) : OPTIONS || {},
+
+
+ // Merge the default classes with the settings classes.
+ CLASSES = $.extend( {}, PickerConstructor.klasses(), SETTINGS.klass ),
+
+
+ // The element node wrapper into a jQuery object.
+ $ELEMENT = $( ELEMENT ),
+
+
+ // Pseudo picker constructor.
+ PickerInstance = function() {
+ return this.start()
+ },
+
+
+ // The picker prototype.
+ P = PickerInstance.prototype = {
+
+ constructor: PickerInstance,
+
+ $node: $ELEMENT,
+
+
+ /**
+ * Initialize everything
+ */
+ start: function() {
+
+ // If it’s already started, do nothing.
+ if ( STATE && STATE.start ) return P
+
+
+ // Update the picker states.
+ STATE.methods = {}
+ STATE.start = true
+ STATE.open = false
+ STATE.type = ELEMENT.type
+
+
+ // Confirm focus state, convert into text input to remove UA stylings,
+ // and set as readonly to prevent keyboard popup.
+ ELEMENT.autofocus = ELEMENT == getActiveElement()
+ ELEMENT.readOnly = !SETTINGS.editable
+ ELEMENT.id = ELEMENT.id || STATE.id
+ if ( ELEMENT.type != 'text' ) {
+ ELEMENT.type = 'text'
+ }
+
+
+ // Create a new picker component with the settings.
+ P.component = new COMPONENT(P, SETTINGS)
+
+
+ // Create the picker root and then prepare it.
+ P.$root = $( '' )
+ prepareElementRoot()
+
+
+ // Create the picker holder and then prepare it.
+ P.$holder = $( createWrappedComponent() ).appendTo( P.$root )
+ prepareElementHolder()
+
+
+ // If there’s a format for the hidden input element, create the element.
+ if ( SETTINGS.formatSubmit ) {
+ prepareElementHidden()
+ }
+
+
+ // Prepare the input element.
+ prepareElement()
+
+
+ // Insert the hidden input as specified in the settings.
+ if ( SETTINGS.containerHidden ) $( SETTINGS.containerHidden ).append( P._hidden )
+ else $ELEMENT.after( P._hidden )
+
+
+ // Insert the root as specified in the settings.
+ if ( SETTINGS.container ) $( SETTINGS.container ).append( P.$root )
+ else $ELEMENT.after( P.$root )
+
+
+ // Bind the default component and settings events.
+ P.on({
+ start: P.component.onStart,
+ render: P.component.onRender,
+ stop: P.component.onStop,
+ open: P.component.onOpen,
+ close: P.component.onClose,
+ set: P.component.onSet
+ }).on({
+ start: SETTINGS.onStart,
+ render: SETTINGS.onRender,
+ stop: SETTINGS.onStop,
+ open: SETTINGS.onOpen,
+ close: SETTINGS.onClose,
+ set: SETTINGS.onSet
+ })
+
+
+ // Once we’re all set, check the theme in use.
+ IS_DEFAULT_THEME = isUsingDefaultTheme( P.$holder[0] )
+
+
+ // If the element has autofocus, open the picker.
+ if ( ELEMENT.autofocus ) {
+ P.open()
+ }
+
+
+ // Trigger queued the “start” and “render” events.
+ return P.trigger( 'start' ).trigger( 'render' )
+ }, //start
+
+
+ /**
+ * Render a new picker
+ */
+ render: function( entireComponent ) {
+
+ // Insert a new component holder in the root or box.
+ if ( entireComponent ) {
+ P.$holder = $( createWrappedComponent() )
+ prepareElementHolder()
+ P.$root.html( P.$holder )
+ }
+ else P.$root.find( '.' + CLASSES.box ).html( P.component.nodes( STATE.open ) )
+
+ // Trigger the queued “render” events.
+ return P.trigger( 'render' )
+ }, //render
+
+
+ /**
+ * Destroy everything
+ */
+ stop: function() {
+
+ // If it’s already stopped, do nothing.
+ if ( !STATE.start ) return P
+
+ // Then close the picker.
+ P.close()
+
+ // Remove the hidden field.
+ if ( P._hidden ) {
+ P._hidden.parentNode.removeChild( P._hidden )
+ }
+
+ // Remove the root.
+ P.$root.remove()
+
+ // Remove the input class, remove the stored data, and unbind
+ // the events (after a tick for IE - see `P.close`).
+ $ELEMENT.removeClass( CLASSES.input ).removeData( NAME )
+ setTimeout( function() {
+ $ELEMENT.off( '.' + STATE.id )
+ }, 0)
+
+ // Restore the element state
+ ELEMENT.type = STATE.type
+ ELEMENT.readOnly = false
+
+ // Trigger the queued “stop” events.
+ P.trigger( 'stop' )
+
+ // Reset the picker states.
+ STATE.methods = {}
+ STATE.start = false
+
+ return P
+ }, //stop
+
+
+ /**
+ * Open up the picker
+ */
+ open: function( dontGiveFocus ) {
+
+ // If it’s already open, do nothing.
+ if ( STATE.open ) return P
+
+ // Add the “active” class.
+ $ELEMENT.addClass( CLASSES.active )
+ aria( ELEMENT, 'expanded', true )
+
+ // * A Firefox bug, when `html` has `overflow:hidden`, results in
+ // killing transitions :(. So add the “opened” state on the next tick.
+ // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
+ setTimeout( function() {
+
+ // Add the “opened” class to the picker root.
+ P.$root.addClass( CLASSES.opened )
+ aria( P.$root[0], 'hidden', false )
+
+ }, 0 )
+
+ // If we have to give focus, bind the element and doc events.
+ if ( dontGiveFocus !== false ) {
+
+ // Set it as open.
+ STATE.open = true
+
+ // Prevent the page from scrolling.
+ if ( IS_DEFAULT_THEME ) {
+ $html.
+ css( 'overflow', 'hidden' ).
+ css( 'padding-right', '+=' + getScrollbarWidth() )
+ }
+
+ // Pass focus to the root element’s jQuery object.
+ focusPickerOnceOpened()
+
+ // Bind the document events.
+ $document.on( 'click.' + STATE.id + ' focusin.' + STATE.id, function( event ) {
+
+ var target = event.target
+
+ // If the target of the event is not the element, close the picker picker.
+ // * Don’t worry about clicks or focusins on the root because those don’t bubble up.
+ // Also, for Firefox, a click on an `option` element bubbles up directly
+ // to the doc. So make sure the target wasn't the doc.
+ // * In Firefox stopPropagation() doesn’t prevent right-click events from bubbling,
+ // which causes the picker to unexpectedly close when right-clicking it. So make
+ // sure the event wasn’t a right-click.
+ if ( target != ELEMENT && target != document && event.which != 3 ) {
+
+ // If the target was the holder that covers the screen,
+ // keep the element focused to maintain tabindex.
+ P.close( target === P.$holder[0] )
+ }
+
+ }).on( 'keydown.' + STATE.id, function( event ) {
+
+ var
+ // Get the keycode.
+ keycode = event.keyCode,
+
+ // Translate that to a selection change.
+ keycodeToMove = P.component.key[ keycode ],
+
+ // Grab the target.
+ target = event.target
+
+
+ // On escape, close the picker and give focus.
+ if ( keycode == 27 ) {
+ P.close( true )
+ }
+
+
+ // Check if there is a key movement or “enter” keypress on the element.
+ else if ( target == P.$holder[0] && ( keycodeToMove || keycode == 13 ) ) {
+
+ // Prevent the default action to stop page movement.
+ event.preventDefault()
+
+ // Trigger the key movement action.
+ if ( keycodeToMove ) {
+ PickerConstructor._.trigger( P.component.key.go, P, [ PickerConstructor._.trigger( keycodeToMove ) ] )
+ }
+
+ // On “enter”, if the highlighted item isn’t disabled, set the value and close.
+ else if ( !P.$root.find( '.' + CLASSES.highlighted ).hasClass( CLASSES.disabled ) ) {
+ P.set( 'select', P.component.item.highlight )
+ if ( SETTINGS.closeOnSelect ) {
+ P.close( true )
+ }
+ }
+ }
+
+
+ // If the target is within the root and “enter” is pressed,
+ // prevent the default action and trigger a click on the target instead.
+ else if ( $.contains( P.$root[0], target ) && keycode == 13 ) {
+ event.preventDefault()
+ target.click()
+ }
+ })
+ }
+
+ // Trigger the queued “open” events.
+ return P.trigger( 'open' )
+ }, //open
+
+
+ /**
+ * Close the picker
+ */
+ close: function( giveFocus ) {
+
+ // If we need to give focus, do it before changing states.
+ if ( giveFocus ) {
+ if ( SETTINGS.editable ) {
+ ELEMENT.focus()
+ }
+ else {
+ // ....ah yes! It would’ve been incomplete without a crazy workaround for IE :|
+ // The focus is triggered *after* the close has completed - causing it
+ // to open again. So unbind and rebind the event at the next tick.
+ P.$holder.off( 'focus.toOpen' ).focus()
+ setTimeout( function() {
+ P.$holder.on( 'focus.toOpen', handleFocusToOpenEvent )
+ }, 0 )
+ }
+ }
+
+ // Remove the “active” class.
+ $ELEMENT.removeClass( CLASSES.active )
+ aria( ELEMENT, 'expanded', false )
+
+ // * A Firefox bug, when `html` has `overflow:hidden`, results in
+ // killing transitions :(. So remove the “opened” state on the next tick.
+ // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
+ setTimeout( function() {
+
+ // Remove the “opened” and “focused” class from the picker root.
+ P.$root.removeClass( CLASSES.opened + ' ' + CLASSES.focused )
+ aria( P.$root[0], 'hidden', true )
+
+ }, 0 )
+
+ // If it’s already closed, do nothing more.
+ if ( !STATE.open ) return P
+
+ // Set it as closed.
+ STATE.open = false
+
+ // Allow the page to scroll.
+ if ( IS_DEFAULT_THEME ) {
+ $html.
+ css( 'overflow', '' ).
+ css( 'padding-right', '-=' + getScrollbarWidth() )
+ }
+
+ // Unbind the document events.
+ $document.off( '.' + STATE.id )
+
+ // Trigger the queued “close” events.
+ return P.trigger( 'close' )
+ }, //close
+
+
+ /**
+ * Clear the values
+ */
+ clear: function( options ) {
+ return P.set( 'clear', null, options )
+ }, //clear
+
+
+ /**
+ * Set something
+ */
+ set: function( thing, value, options ) {
+
+ var thingItem, thingValue,
+ thingIsObject = $.isPlainObject( thing ),
+ thingObject = thingIsObject ? thing : {}
+
+ // Make sure we have usable options.
+ options = thingIsObject && $.isPlainObject( value ) ? value : options || {}
+
+ if ( thing ) {
+
+ // If the thing isn’t an object, make it one.
+ if ( !thingIsObject ) {
+ thingObject[ thing ] = value
+ }
+
+ // Go through the things of items to set.
+ for ( thingItem in thingObject ) {
+
+ // Grab the value of the thing.
+ thingValue = thingObject[ thingItem ]
+
+ // First, if the item exists and there’s a value, set it.
+ if ( thingItem in P.component.item ) {
+ if ( thingValue === undefined ) thingValue = null
+ P.component.set( thingItem, thingValue, options )
+ }
+
+ // Then, check to update the element value and broadcast a change.
+ if ( thingItem == 'select' || thingItem == 'clear' ) {
+ $ELEMENT.
+ val( thingItem == 'clear' ? '' : P.get( thingItem, SETTINGS.format ) ).
+ trigger( 'change' )
+ }
+ }
+
+ // Render a new picker.
+ P.render()
+ }
+
+ // When the method isn’t muted, trigger queued “set” events and pass the `thingObject`.
+ return options.muted ? P : P.trigger( 'set', thingObject )
+ }, //set
+
+
+ /**
+ * Get something
+ */
+ get: function( thing, format ) {
+
+ // Make sure there’s something to get.
+ thing = thing || 'value'
+
+ // If a picker state exists, return that.
+ if ( STATE[ thing ] != null ) {
+ return STATE[ thing ]
+ }
+
+ // Return the submission value, if that.
+ if ( thing == 'valueSubmit' ) {
+ if ( P._hidden ) {
+ return P._hidden.value
+ }
+ thing = 'value'
+ }
+
+ // Return the value, if that.
+ if ( thing == 'value' ) {
+ return ELEMENT.value
+ }
+
+ // Check if a component item exists, return that.
+ if ( thing in P.component.item ) {
+ if ( typeof format == 'string' ) {
+ var thingValue = P.component.get( thing )
+ return thingValue ?
+ PickerConstructor._.trigger(
+ P.component.formats.toString,
+ P.component,
+ [ format, thingValue ]
+ ) : ''
+ }
+ return P.component.get( thing )
+ }
+ }, //get
+
+
+
+ /**
+ * Bind events on the things.
+ */
+ on: function( thing, method, internal ) {
+
+ var thingName, thingMethod,
+ thingIsObject = $.isPlainObject( thing ),
+ thingObject = thingIsObject ? thing : {}
+
+ if ( thing ) {
+
+ // If the thing isn’t an object, make it one.
+ if ( !thingIsObject ) {
+ thingObject[ thing ] = method
+ }
+
+ // Go through the things to bind to.
+ for ( thingName in thingObject ) {
+
+ // Grab the method of the thing.
+ thingMethod = thingObject[ thingName ]
+
+ // If it was an internal binding, prefix it.
+ if ( internal ) {
+ thingName = '_' + thingName
+ }
+
+ // Make sure the thing methods collection exists.
+ STATE.methods[ thingName ] = STATE.methods[ thingName ] || []
+
+ // Add the method to the relative method collection.
+ STATE.methods[ thingName ].push( thingMethod )
+ }
+ }
+
+ return P
+ }, //on
+
+
+
+ /**
+ * Unbind events on the things.
+ */
+ off: function() {
+ var i, thingName,
+ names = arguments;
+ for ( i = 0, namesCount = names.length; i < namesCount; i += 1 ) {
+ thingName = names[i]
+ if ( thingName in STATE.methods ) {
+ delete STATE.methods[thingName]
+ }
+ }
+ return P
+ },
+
+
+ /**
+ * Fire off method events.
+ */
+ trigger: function( name, data ) {
+ var _trigger = function( name ) {
+ var methodList = STATE.methods[ name ]
+ if ( methodList ) {
+ methodList.map( function( method ) {
+ PickerConstructor._.trigger( method, P, [ data ] )
+ })
+ }
+ }
+ _trigger( '_' + name )
+ _trigger( name )
+ return P
+ } //trigger
+ } //PickerInstance.prototype
+
+
+ /**
+ * Wrap the picker holder components together.
+ */
+ function createWrappedComponent() {
+
+ // Create a picker wrapper holder
+ return PickerConstructor._.node( 'div',
+
+ // Create a picker wrapper node
+ PickerConstructor._.node( 'div',
+
+ // Create a picker frame
+ PickerConstructor._.node( 'div',
+
+ // Create a picker box node
+ PickerConstructor._.node( 'div',
+
+ // Create the components nodes.
+ P.component.nodes( STATE.open ),
+
+ // The picker box class
+ CLASSES.box
+ ),
+
+ // Picker wrap class
+ CLASSES.wrap
+ ),
+
+ // Picker frame class
+ CLASSES.frame
+ ),
+
+ // Picker holder class
+ CLASSES.holder,
+
+ 'tabindex="-1"'
+ ) //endreturn
+ } //createWrappedComponent
+
+
+
+ /**
+ * Prepare the input element with all bindings.
+ */
+ function prepareElement() {
+
+ $ELEMENT.
+
+ // Store the picker data by component name.
+ data(NAME, P).
+
+ // Add the “input” class name.
+ addClass(CLASSES.input).
+
+ // If there’s a `data-value`, update the value of the element.
+ val( $ELEMENT.data('value') ?
+ P.get('select', SETTINGS.format) :
+ ELEMENT.value
+ )
+
+
+ // Only bind keydown events if the element isn’t editable.
+ if ( !SETTINGS.editable ) {
+
+ $ELEMENT.
+
+ // On focus/click, open the picker.
+ on( 'focus.' + STATE.id + ' click.' + STATE.id, function(event) {
+ event.preventDefault()
+ P.open()
+ }).
+
+ // Handle keyboard event based on the picker being opened or not.
+ on( 'keydown.' + STATE.id, handleKeydownEvent )
+ }
+
+
+ // Update the aria attributes.
+ aria(ELEMENT, {
+ haspopup: true,
+ expanded: false,
+ readonly: false,
+ owns: ELEMENT.id + '_root'
+ })
+ }
+
+
+ /**
+ * Prepare the root picker element with all bindings.
+ */
+ function prepareElementRoot() {
+ aria( P.$root[0], 'hidden', true )
+ }
+
+
+ /**
+ * Prepare the holder picker element with all bindings.
+ */
+ function prepareElementHolder() {
+
+ P.$holder.
+
+ on({
+
+ // For iOS8.
+ keydown: handleKeydownEvent,
+
+ 'focus.toOpen': handleFocusToOpenEvent,
+
+ blur: function() {
+ // Remove the “target” class.
+ $ELEMENT.removeClass( CLASSES.target )
+ },
+
+ // When something within the holder is focused, stop from bubbling
+ // to the doc and remove the “focused” state from the root.
+ focusin: function( event ) {
+ P.$root.removeClass( CLASSES.focused )
+ event.stopPropagation()
+ },
+
+ // When something within the holder is clicked, stop it
+ // from bubbling to the doc.
+ 'mousedown click': function( event ) {
+
+ var target = event.target
+
+ // Make sure the target isn’t the root holder so it can bubble up.
+ if ( target != P.$holder[0] ) {
+
+ event.stopPropagation()
+
+ // * For mousedown events, cancel the default action in order to
+ // prevent cases where focus is shifted onto external elements
+ // when using things like jQuery mobile or MagnificPopup (ref: #249 & #120).
+ // Also, for Firefox, don’t prevent action on the `option` element.
+ if ( event.type == 'mousedown' && !$( target ).is( 'input, select, textarea, button, option' )) {
+
+ event.preventDefault()
+
+ // Re-focus onto the holder so that users can click away
+ // from elements focused within the picker.
+ P.$holder[0].focus()
+ }
+ }
+ }
+
+ }).
+
+ // If there’s a click on an actionable element, carry out the actions.
+ on( 'click', '[data-pick], [data-nav], [data-clear], [data-close]', function() {
+
+ var $target = $( this ),
+ targetData = $target.data(),
+ targetDisabled = $target.hasClass( CLASSES.navDisabled ) || $target.hasClass( CLASSES.disabled ),
+
+ // * For IE, non-focusable elements can be active elements as well
+ // (http://stackoverflow.com/a/2684561).
+ activeElement = getActiveElement()
+ activeElement = activeElement && ( activeElement.type || activeElement.href )
+
+ // If it’s disabled or nothing inside is actively focused, re-focus the element.
+ if ( targetDisabled || activeElement && !$.contains( P.$root[0], activeElement ) ) {
+ P.$holder[0].focus()
+ }
+
+ // If something is superficially changed, update the `highlight` based on the `nav`.
+ if ( !targetDisabled && targetData.nav ) {
+ P.set( 'highlight', P.component.item.highlight, { nav: targetData.nav } )
+ }
+
+ // If something is picked, set `select` then close with focus.
+ else if ( !targetDisabled && 'pick' in targetData ) {
+ P.set( 'select', targetData.pick )
+ if ( SETTINGS.closeOnSelect ) {
+ P.close( true )
+ }
+ }
+
+ // If a “clear” button is pressed, empty the values and close with focus.
+ else if ( targetData.clear ) {
+ P.clear()
+ if ( SETTINGS.closeOnClear ) {
+ P.close( true )
+ }
+ }
+
+ else if ( targetData.close ) {
+ P.close( true )
+ }
+
+ }) //P.$holder
+
+ }
+
+
+ /**
+ * Prepare the hidden input element along with all bindings.
+ */
+ function prepareElementHidden() {
+
+ var name
+
+ if ( SETTINGS.hiddenName === true ) {
+ name = ELEMENT.name
+ ELEMENT.name = ''
+ }
+ else {
+ name = [
+ typeof SETTINGS.hiddenPrefix == 'string' ? SETTINGS.hiddenPrefix : '',
+ typeof SETTINGS.hiddenSuffix == 'string' ? SETTINGS.hiddenSuffix : '_submit'
+ ]
+ name = name[0] + ELEMENT.name + name[1]
+ }
+
+ P._hidden = $(
+ ''
+ )[0]
+
+ $ELEMENT.
+
+ // If the value changes, update the hidden input with the correct format.
+ on('change.' + STATE.id, function() {
+ P._hidden.value = ELEMENT.value ?
+ P.get('select', SETTINGS.formatSubmit) :
+ ''
+ })
+ }
+
+
+ // Wait for transitions to end before focusing the holder. Otherwise, while
+ // using the `container` option, the view jumps to the container.
+ function focusPickerOnceOpened() {
+
+ if (IS_DEFAULT_THEME && supportsTransitions) {
+ P.$holder.find('.' + CLASSES.frame).one('transitionend', function() {
+ P.$holder[0].focus()
+ })
+ }
+ else {
+ P.$holder[0].focus()
+ }
+ }
+
+
+ function handleFocusToOpenEvent(event) {
+
+ // Stop the event from propagating to the doc.
+ event.stopPropagation()
+
+ // Add the “target” class.
+ $ELEMENT.addClass( CLASSES.target )
+
+ // Add the “focused” class to the root.
+ P.$root.addClass( CLASSES.focused )
+
+ // And then finally open the picker.
+ P.open()
+ }
+
+
+ // For iOS8.
+ function handleKeydownEvent( event ) {
+
+ var keycode = event.keyCode,
+
+ // Check if one of the delete keys was pressed.
+ isKeycodeDelete = /^(8|46)$/.test(keycode)
+
+ // For some reason IE clears the input value on “escape”.
+ if ( keycode == 27 ) {
+ P.close( true )
+ return false
+ }
+
+ // Check if `space` or `delete` was pressed or the picker is closed with a key movement.
+ if ( keycode == 32 || isKeycodeDelete || !STATE.open && P.component.key[keycode] ) {
+
+ // Prevent it from moving the page and bubbling to doc.
+ event.preventDefault()
+ event.stopPropagation()
+
+ // If `delete` was pressed, clear the values and close the picker.
+ // Otherwise open the picker.
+ if ( isKeycodeDelete ) { P.clear().close() }
+ else { P.open() }
+ }
+ }
+
+
+ // Return a new picker instance.
+ return new PickerInstance()
+} //PickerConstructor
+
+
+
+/**
+ * The default classes and prefix to use for the HTML classes.
+ */
+PickerConstructor.klasses = function( prefix ) {
+ prefix = prefix || 'picker'
+ return {
+
+ picker: prefix,
+ opened: prefix + '--opened',
+ focused: prefix + '--focused',
+
+ input: prefix + '__input',
+ active: prefix + '__input--active',
+ target: prefix + '__input--target',
+
+ holder: prefix + '__holder',
+
+ frame: prefix + '__frame',
+ wrap: prefix + '__wrap',
+
+ box: prefix + '__box'
+ }
+} //PickerConstructor.klasses
+
+
+
+/**
+ * Check if the default theme is being used.
+ */
+function isUsingDefaultTheme( element ) {
+
+ var theme,
+ prop = 'position'
+
+ // For IE.
+ if ( element.currentStyle ) {
+ theme = element.currentStyle[prop]
+ }
+
+ // For normal browsers.
+ else if ( window.getComputedStyle ) {
+ theme = getComputedStyle( element )[prop]
+ }
+
+ return theme == 'fixed'
+}
+
+
+
+/**
+ * Get the width of the browser’s scrollbar.
+ * Taken from: https://github.com/VodkaBears/Remodal/blob/master/src/jquery.remodal.js
+ */
+function getScrollbarWidth() {
+
+ if ( $html.height() <= $window.height() ) {
+ return 0
+ }
+
+ var $outer = $( '' ).
+ appendTo( 'body' )
+
+ // Get the width without scrollbars.
+ var widthWithoutScroll = $outer[0].offsetWidth
+
+ // Force adding scrollbars.
+ $outer.css( 'overflow', 'scroll' )
+
+ // Add the inner div.
+ var $inner = $( '' ).appendTo( $outer )
+
+ // Get the width with scrollbars.
+ var widthWithScroll = $inner[0].offsetWidth
+
+ // Remove the divs.
+ $outer.remove()
+
+ // Return the difference between the widths.
+ return widthWithoutScroll - widthWithScroll
+}
+
+
+
+/**
+ * PickerConstructor helper methods.
+ */
+PickerConstructor._ = {
+
+ /**
+ * Create a group of nodes. Expects:
+ * `
+ {
+ min: {Integer},
+ max: {Integer},
+ i: {Integer},
+ node: {String},
+ item: {Function}
+ }
+ * `
+ */
+ group: function( groupObject ) {
+
+ var
+ // Scope for the looped object
+ loopObjectScope,
+
+ // Create the nodes list
+ nodesList = '',
+
+ // The counter starts from the `min`
+ counter = PickerConstructor._.trigger( groupObject.min, groupObject )
+
+
+ // Loop from the `min` to `max`, incrementing by `i`
+ for ( ; counter <= PickerConstructor._.trigger( groupObject.max, groupObject, [ counter ] ); counter += groupObject.i ) {
+
+ // Trigger the `item` function within scope of the object
+ loopObjectScope = PickerConstructor._.trigger( groupObject.item, groupObject, [ counter ] )
+
+ // Splice the subgroup and create nodes out of the sub nodes
+ nodesList += PickerConstructor._.node(
+ groupObject.node,
+ loopObjectScope[ 0 ], // the node
+ loopObjectScope[ 1 ], // the classes
+ loopObjectScope[ 2 ] // the attributes
+ )
+ }
+
+ // Return the list of nodes
+ return nodesList
+ }, //group
+
+
+ /**
+ * Create a dom node string
+ */
+ node: function( wrapper, item, klass, attribute ) {
+
+ // If the item is false-y, just return an empty string
+ if ( !item ) return ''
+
+ // If the item is an array, do a join
+ item = $.isArray( item ) ? item.join( '' ) : item
+
+ // Check for the class
+ klass = klass ? ' class="' + klass + '"' : ''
+
+ // Check for any attributes
+ attribute = attribute ? ' ' + attribute : ''
+
+ // Return the wrapped item
+ return '<' + wrapper + klass + attribute + '>' + item + '' + wrapper + '>'
+ }, //node
+
+
+ /**
+ * Lead numbers below 10 with a zero.
+ */
+ lead: function( number ) {
+ return ( number < 10 ? '0': '' ) + number
+ },
+
+
+ /**
+ * Trigger a function otherwise return the value.
+ */
+ trigger: function( callback, scope, args ) {
+ return typeof callback == 'function' ? callback.apply( scope, args || [] ) : callback
+ },
+
+
+ /**
+ * If the second character is a digit, length is 2 otherwise 1.
+ */
+ digits: function( string ) {
+ return ( /\d/ ).test( string[ 1 ] ) ? 2 : 1
+ },
+
+
+ /**
+ * Tell if something is a date object.
+ */
+ isDate: function( value ) {
+ return {}.toString.call( value ).indexOf( 'Date' ) > -1 && this.isInteger( value.getDate() )
+ },
+
+
+ /**
+ * Tell if something is an integer.
+ */
+ isInteger: function( value ) {
+ return {}.toString.call( value ).indexOf( 'Number' ) > -1 && value % 1 === 0
+ },
+
+
+ /**
+ * Create ARIA attribute strings.
+ */
+ ariaAttr: ariaAttr
+} //PickerConstructor._
+
+
+
+/**
+ * Extend the picker with a component and defaults.
+ */
+PickerConstructor.extend = function( name, Component ) {
+
+ // Extend jQuery.
+ $.fn[ name ] = function( options, action ) {
+
+ // Grab the component data.
+ var componentData = this.data( name )
+
+ // If the picker is requested, return the data object.
+ if ( options == 'picker' ) {
+ return componentData
+ }
+
+ // If the component data exists and `options` is a string, carry out the action.
+ if ( componentData && typeof options == 'string' ) {
+ return PickerConstructor._.trigger( componentData[ options ], componentData, [ action ] )
+ }
+
+ // Otherwise go through each matched element and if the component
+ // doesn’t exist, create a new picker using `this` element
+ // and merging the defaults and options with a deep copy.
+ return this.each( function() {
+ var $this = $( this )
+ if ( !$this.data( name ) ) {
+ new PickerConstructor( this, name, Component, options )
+ }
+ })
+ }
+
+ // Set the defaults.
+ $.fn[ name ].defaults = Component.defaults
+} //PickerConstructor.extend
+
+
+
+function aria(element, attribute, value) {
+ if ( $.isPlainObject(attribute) ) {
+ for ( var key in attribute ) {
+ ariaSet(element, key, attribute[key])
+ }
+ }
+ else {
+ ariaSet(element, attribute, value)
+ }
+}
+function ariaSet(element, attribute, value) {
+ element.setAttribute(
+ (attribute == 'role' ? '' : 'aria-') + attribute,
+ value
+ )
+}
+function ariaAttr(attribute, data) {
+ if ( !$.isPlainObject(attribute) ) {
+ attribute = { attribute: data }
+ }
+ data = ''
+ for ( var key in attribute ) {
+ var attr = (key == 'role' ? '' : 'aria-') + key,
+ attrVal = attribute[key]
+ data += attrVal == null ? '' : attr + '="' + attribute[key] + '"'
+ }
+ return data
+}
+
+// IE8 bug throws an error for activeElements within iframes.
+function getActiveElement() {
+ try {
+ return document.activeElement
+ } catch ( err ) { }
+}
+
+
+
+// Expose the picker constructor.
+return PickerConstructor
+
+
+}));
+
+
+
diff --git a/vendor/assets/javascripts/pickadate/picker.time.js b/vendor/assets/javascripts/pickadate/picker.time.js
new file mode 100644
index 00000000..99f15482
--- /dev/null
+++ b/vendor/assets/javascripts/pickadate/picker.time.js
@@ -0,0 +1,1013 @@
+/*!
+ * Time picker for pickadate.js v3.5.6
+ * http://amsul.github.io/pickadate.js/time.htm
+ */
+
+(function ( factory ) {
+
+ // AMD.
+ if ( typeof define == 'function' && define.amd )
+ define( ['picker', 'jquery'], factory )
+
+ // Node.js/browserify.
+ else if ( typeof exports == 'object' )
+ module.exports = factory( require('./picker.js'), require('jquery') )
+
+ // Browser globals.
+ else factory( Picker, jQuery )
+
+}(function( Picker, $ ) {
+
+
+/**
+ * Globals and constants
+ */
+var HOURS_IN_DAY = 24,
+ MINUTES_IN_HOUR = 60,
+ HOURS_TO_NOON = 12,
+ MINUTES_IN_DAY = HOURS_IN_DAY * MINUTES_IN_HOUR,
+ _ = Picker._
+
+
+
+/**
+ * The time picker constructor
+ */
+function TimePicker( picker, settings ) {
+
+ var clock = this,
+ elementValue = picker.$node[ 0 ].value,
+ elementDataValue = picker.$node.data( 'value' ),
+ valueString = elementDataValue || elementValue,
+ formatString = elementDataValue ? settings.formatSubmit : settings.format
+
+ clock.settings = settings
+ clock.$node = picker.$node
+
+ // The queue of methods that will be used to build item objects.
+ clock.queue = {
+ interval: 'i',
+ min: 'measure create',
+ max: 'measure create',
+ now: 'now create',
+ select: 'parse create validate',
+ highlight: 'parse create validate',
+ view: 'parse create validate',
+ disable: 'deactivate',
+ enable: 'activate'
+ }
+
+ // The component's item object.
+ clock.item = {}
+
+ clock.item.clear = null
+ clock.item.interval = settings.interval || 30
+ clock.item.disable = ( settings.disable || [] ).slice( 0 )
+ clock.item.enable = -(function( collectionDisabled ) {
+ return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1
+ })( clock.item.disable )
+
+ clock.
+ set( 'min', settings.min ).
+ set( 'max', settings.max ).
+ set( 'now' )
+
+ // When there’s a value, set the `select`, which in turn
+ // also sets the `highlight` and `view`.
+ if ( valueString ) {
+ clock.set( 'select', valueString, {
+ format: formatString
+ })
+ }
+
+ // If there’s no value, default to highlighting “today”.
+ else {
+ clock.
+ set( 'select', null ).
+ set( 'highlight', clock.item.now )
+ }
+
+ // The keycode to movement mapping.
+ clock.key = {
+ 40: 1, // Down
+ 38: -1, // Up
+ 39: 1, // Right
+ 37: -1, // Left
+ go: function( timeChange ) {
+ clock.set(
+ 'highlight',
+ clock.item.highlight.pick + timeChange * clock.item.interval,
+ { interval: timeChange * clock.item.interval }
+ )
+ this.render()
+ }
+ }
+
+
+ // Bind some picker events.
+ picker.
+ on( 'render', function() {
+ var $pickerHolder = picker.$root.children(),
+ $viewset = $pickerHolder.find( '.' + settings.klass.viewset ),
+ vendors = function( prop ) {
+ return ['webkit', 'moz', 'ms', 'o', ''].map(function( vendor ) {
+ return ( vendor ? '-' + vendor + '-' : '' ) + prop
+ })
+ },
+ animations = function( $el, state ) {
+ vendors( 'transform' ).map(function( prop ) {
+ $el.css( prop, state )
+ })
+ vendors( 'transition' ).map(function( prop ) {
+ $el.css( prop, state )
+ })
+ }
+ if ( $viewset.length ) {
+ animations( $pickerHolder, 'none' )
+ $pickerHolder[ 0 ].scrollTop = ~~$viewset.position().top - ( $viewset[ 0 ].clientHeight * 2 )
+ animations( $pickerHolder, '' )
+ }
+ }, 1 ).
+ on( 'open', function() {
+ picker.$root.find( 'button' ).attr( 'disabled', false )
+ }, 1 ).
+ on( 'close', function() {
+ picker.$root.find( 'button' ).attr( 'disabled', true )
+ }, 1 )
+
+} //TimePicker
+
+
+/**
+ * Set a timepicker item object.
+ */
+TimePicker.prototype.set = function( type, value, options ) {
+
+ var clock = this,
+ clockItem = clock.item
+
+ // If the value is `null` just set it immediately.
+ if ( value === null ) {
+ if ( type == 'clear' ) type = 'select'
+ clockItem[ type ] = value
+ return clock
+ }
+
+ // Otherwise go through the queue of methods, and invoke the functions.
+ // Update this as the time unit, and set the final value as this item.
+ // * In the case of `enable`, keep the queue but set `disable` instead.
+ // And in the case of `flip`, keep the queue but set `enable` instead.
+ clockItem[ ( type == 'enable' ? 'disable' : type == 'flip' ? 'enable' : type ) ] = clock.queue[ type ].split( ' ' ).map( function( method ) {
+ value = clock[ method ]( type, value, options )
+ return value
+ }).pop()
+
+ // Check if we need to cascade through more updates.
+ if ( type == 'select' ) {
+ clock.set( 'highlight', clockItem.select, options )
+ }
+ else if ( type == 'highlight' ) {
+ clock.set( 'view', clockItem.highlight, options )
+ }
+ else if ( type == 'interval' ) {
+ clock.
+ set( 'min', clockItem.min, options ).
+ set( 'max', clockItem.max, options )
+ }
+ else if ( type.match( /^(flip|min|max|disable|enable)$/ ) ) {
+ if ( clockItem.select && clock.disabled( clockItem.select ) ) {
+ clock.set( 'select', value, options )
+ }
+ if ( clockItem.highlight && clock.disabled( clockItem.highlight ) ) {
+ clock.set( 'highlight', value, options )
+ }
+ if ( type == 'min' ) {
+ clock.set( 'max', clockItem.max, options )
+ }
+ }
+
+ return clock
+} //TimePicker.prototype.set
+
+
+/**
+ * Get a timepicker item object.
+ */
+TimePicker.prototype.get = function( type ) {
+ return this.item[ type ]
+} //TimePicker.prototype.get
+
+
+/**
+ * Create a picker time object.
+ */
+TimePicker.prototype.create = function( type, value, options ) {
+
+ var clock = this
+
+ // If there’s no value, use the type as the value.
+ value = value === undefined ? type : value
+
+ // If it’s a date object, convert it into an array.
+ if ( _.isDate( value ) ) {
+ value = [ value.getHours(), value.getMinutes() ]
+ }
+
+ // If it’s an object, use the “pick” value.
+ if ( $.isPlainObject( value ) && _.isInteger( value.pick ) ) {
+ value = value.pick
+ }
+
+ // If it’s an array, convert it into minutes.
+ else if ( $.isArray( value ) ) {
+ value = +value[ 0 ] * MINUTES_IN_HOUR + (+value[ 1 ])
+ }
+
+ // If no valid value is passed, set it to “now”.
+ else if ( !_.isInteger( value ) ) {
+ value = clock.now( type, value, options )
+ }
+
+ // If we’re setting the max, make sure it’s greater than the min.
+ if ( type == 'max' && value < clock.item.min.pick ) {
+ value += MINUTES_IN_DAY
+ }
+
+ // If the value doesn’t fall directly on the interval,
+ // add one interval to indicate it as “passed”.
+ if ( type != 'min' && type != 'max' && (value - clock.item.min.pick) % clock.item.interval !== 0 ) {
+ value += clock.item.interval
+ }
+
+ // Normalize it into a “reachable” interval.
+ value = clock.normalize( type, value, options )
+
+ // Return the compiled object.
+ return {
+
+ // Divide to get hours from minutes.
+ hour: ~~( HOURS_IN_DAY + value / MINUTES_IN_HOUR ) % HOURS_IN_DAY,
+
+ // The remainder is the minutes.
+ mins: ( MINUTES_IN_HOUR + value % MINUTES_IN_HOUR ) % MINUTES_IN_HOUR,
+
+ // The time in total minutes.
+ time: ( MINUTES_IN_DAY + value ) % MINUTES_IN_DAY,
+
+ // Reference to the “relative” value to pick.
+ pick: value % MINUTES_IN_DAY
+ }
+} //TimePicker.prototype.create
+
+
+/**
+ * Create a range limit object using an array, date object,
+ * literal “true”, or integer relative to another time.
+ */
+TimePicker.prototype.createRange = function( from, to ) {
+
+ var clock = this,
+ createTime = function( time ) {
+ if ( time === true || $.isArray( time ) || _.isDate( time ) ) {
+ return clock.create( time )
+ }
+ return time
+ }
+
+ // Create objects if possible.
+ if ( !_.isInteger( from ) ) {
+ from = createTime( from )
+ }
+ if ( !_.isInteger( to ) ) {
+ to = createTime( to )
+ }
+
+ // Create relative times.
+ if ( _.isInteger( from ) && $.isPlainObject( to ) ) {
+ from = [ to.hour, to.mins + ( from * clock.settings.interval ) ];
+ }
+ else if ( _.isInteger( to ) && $.isPlainObject( from ) ) {
+ to = [ from.hour, from.mins + ( to * clock.settings.interval ) ];
+ }
+
+ return {
+ from: createTime( from ),
+ to: createTime( to )
+ }
+} //TimePicker.prototype.createRange
+
+
+/**
+ * Check if a time unit falls within a time range object.
+ */
+TimePicker.prototype.withinRange = function( range, timeUnit ) {
+ range = this.createRange(range.from, range.to)
+ return timeUnit.pick >= range.from.pick && timeUnit.pick <= range.to.pick
+}
+
+
+/**
+ * Check if two time range objects overlap.
+ */
+TimePicker.prototype.overlapRanges = function( one, two ) {
+
+ var clock = this
+
+ // Convert the ranges into comparable times.
+ one = clock.createRange( one.from, one.to )
+ two = clock.createRange( two.from, two.to )
+
+ return clock.withinRange( one, two.from ) || clock.withinRange( one, two.to ) ||
+ clock.withinRange( two, one.from ) || clock.withinRange( two, one.to )
+}
+
+
+/**
+ * Get the time relative to now.
+ */
+TimePicker.prototype.now = function( type, value/*, options*/ ) {
+
+ var interval = this.item.interval,
+ date = new Date(),
+ nowMinutes = date.getHours() * MINUTES_IN_HOUR + date.getMinutes(),
+ isValueInteger = _.isInteger( value ),
+ isBelowInterval
+
+ // Make sure “now” falls within the interval range.
+ nowMinutes -= nowMinutes % interval
+
+ // Check if the difference is less than the interval itself.
+ isBelowInterval = value < 0 && interval * value + nowMinutes <= -interval
+
+ // Add an interval because the time has “passed”.
+ nowMinutes += type == 'min' && isBelowInterval ? 0 : interval
+
+ // If the value is a number, adjust by that many intervals.
+ if ( isValueInteger ) {
+ nowMinutes += interval * (
+ isBelowInterval && type != 'max' ?
+ value + 1 :
+ value
+ )
+ }
+
+ // Return the final calculation.
+ return nowMinutes
+} //TimePicker.prototype.now
+
+
+/**
+ * Normalize minutes to be “reachable” based on the min and interval.
+ */
+TimePicker.prototype.normalize = function( type, value/*, options*/ ) {
+
+ var interval = this.item.interval,
+ minTime = this.item.min && this.item.min.pick || 0
+
+ // If setting min time, don’t shift anything.
+ // Otherwise get the value and min difference and then
+ // normalize the difference with the interval.
+ value -= type == 'min' ? 0 : ( value - minTime ) % interval
+
+ // Return the adjusted value.
+ return value
+} //TimePicker.prototype.normalize
+
+
+/**
+ * Measure the range of minutes.
+ */
+TimePicker.prototype.measure = function( type, value, options ) {
+
+ var clock = this
+
+ // If it’s anything false-y, set it to the default.
+ if ( !value ) {
+ value = type == 'min' ? [ 0, 0 ] : [ HOURS_IN_DAY - 1, MINUTES_IN_HOUR - 1 ]
+ }
+
+ // If it’s a string, parse it.
+ if ( typeof value == 'string' ) {
+ value = clock.parse( type, value )
+ }
+
+ // If it’s a literal true, or an integer, make it relative to now.
+ else if ( value === true || _.isInteger( value ) ) {
+ value = clock.now( type, value, options )
+ }
+
+ // If it’s an object already, just normalize it.
+ else if ( $.isPlainObject( value ) && _.isInteger( value.pick ) ) {
+ value = clock.normalize( type, value.pick, options )
+ }
+
+ return value
+} ///TimePicker.prototype.measure
+
+
+/**
+ * Validate an object as enabled.
+ */
+TimePicker.prototype.validate = function( type, timeObject, options ) {
+
+ var clock = this,
+ interval = options && options.interval ? options.interval : clock.item.interval
+
+ // Check if the object is disabled.
+ if ( clock.disabled( timeObject ) ) {
+
+ // Shift with the interval until we reach an enabled time.
+ timeObject = clock.shift( timeObject, interval )
+ }
+
+ // Scope the object into range.
+ timeObject = clock.scope( timeObject )
+
+ // Do a second check to see if we landed on a disabled min/max.
+ // In that case, shift using the opposite interval as before.
+ if ( clock.disabled( timeObject ) ) {
+ timeObject = clock.shift( timeObject, interval * -1 )
+ }
+
+ // Return the final object.
+ return timeObject
+} //TimePicker.prototype.validate
+
+
+/**
+ * Check if an object is disabled.
+ */
+TimePicker.prototype.disabled = function( timeToVerify ) {
+
+ var clock = this,
+
+ // Filter through the disabled times to check if this is one.
+ isDisabledMatch = clock.item.disable.filter( function( timeToDisable ) {
+
+ // If the time is a number, match the hours.
+ if ( _.isInteger( timeToDisable ) ) {
+ return timeToVerify.hour == timeToDisable
+ }
+
+ // If it’s an array, create the object and match the times.
+ if ( $.isArray( timeToDisable ) || _.isDate( timeToDisable ) ) {
+ return timeToVerify.pick == clock.create( timeToDisable ).pick
+ }
+
+ // If it’s an object, match a time within the “from” and “to” range.
+ if ( $.isPlainObject( timeToDisable ) ) {
+ return clock.withinRange( timeToDisable, timeToVerify )
+ }
+ })
+
+ // If this time matches a disabled time, confirm it’s not inverted.
+ isDisabledMatch = isDisabledMatch.length && !isDisabledMatch.filter(function( timeToDisable ) {
+ return $.isArray( timeToDisable ) && timeToDisable[2] == 'inverted' ||
+ $.isPlainObject( timeToDisable ) && timeToDisable.inverted
+ }).length
+
+ // If the clock is "enabled" flag is flipped, flip the condition.
+ return clock.item.enable === -1 ? !isDisabledMatch : isDisabledMatch ||
+ timeToVerify.pick < clock.item.min.pick ||
+ timeToVerify.pick > clock.item.max.pick
+} //TimePicker.prototype.disabled
+
+
+/**
+ * Shift an object by an interval until we reach an enabled object.
+ */
+TimePicker.prototype.shift = function( timeObject, interval ) {
+
+ var clock = this,
+ minLimit = clock.item.min.pick,
+ maxLimit = clock.item.max.pick/*,
+ safety = 1000*/
+
+ interval = interval || clock.item.interval
+
+ // Keep looping as long as the time is disabled.
+ while ( /*safety &&*/ clock.disabled( timeObject ) ) {
+
+ /*safety -= 1
+ if ( !safety ) {
+ throw 'Fell into an infinite loop while shifting to ' + timeObject.hour + ':' + timeObject.mins + '.'
+ }*/
+
+ // Increase/decrease the time by the interval and keep looping.
+ timeObject = clock.create( timeObject.pick += interval )
+
+ // If we've looped beyond the limits, break out of the loop.
+ if ( timeObject.pick <= minLimit || timeObject.pick >= maxLimit ) {
+ break
+ }
+ }
+
+ // Return the final object.
+ return timeObject
+} //TimePicker.prototype.shift
+
+
+/**
+ * Scope an object to be within range of min and max.
+ */
+TimePicker.prototype.scope = function( timeObject ) {
+ var minLimit = this.item.min.pick,
+ maxLimit = this.item.max.pick
+ return this.create( timeObject.pick > maxLimit ? maxLimit : timeObject.pick < minLimit ? minLimit : timeObject )
+} //TimePicker.prototype.scope
+
+
+/**
+ * Parse a string into a usable type.
+ */
+TimePicker.prototype.parse = function( type, value, options ) {
+
+ var hour, minutes, isPM, item, parseValue,
+ clock = this,
+ parsingObject = {}
+
+ // If it’s already parsed, we’re good.
+ if ( !value || typeof value != 'string' ) {
+ return value
+ }
+
+ // We need a `.format` to parse the value with.
+ if ( !( options && options.format ) ) {
+ options = options || {}
+ options.format = clock.settings.format
+ }
+
+ // Convert the format into an array and then map through it.
+ clock.formats.toArray( options.format ).map( function( label ) {
+
+ var
+ substring,
+
+ // Grab the formatting label.
+ formattingLabel = clock.formats[ label ],
+
+ // The format length is from the formatting label function or the
+ // label length without the escaping exclamation (!) mark.
+ formatLength = formattingLabel ?
+ _.trigger( formattingLabel, clock, [ value, parsingObject ] ) :
+ label.replace( /^!/, '' ).length
+
+ // If there's a format label, split the value up to the format length.
+ // Then add it to the parsing object with appropriate label.
+ if ( formattingLabel ) {
+ substring = value.substr( 0, formatLength )
+ parsingObject[ label ] = substring.match(/^\d+$/) ? +substring : substring
+ }
+
+ // Update the time value as the substring from format length to end.
+ value = value.substr( formatLength )
+ })
+
+ // Grab the hour and minutes from the parsing object.
+ for ( item in parsingObject ) {
+ parseValue = parsingObject[item]
+ if ( _.isInteger(parseValue) ) {
+ if ( item.match(/^(h|hh)$/i) ) {
+ hour = parseValue
+ if ( item == 'h' || item == 'hh' ) {
+ hour %= 12
+ }
+ }
+ else if ( item == 'i' ) {
+ minutes = parseValue
+ }
+ }
+ else if ( item.match(/^a$/i) && parseValue.match(/^p/i) && ('h' in parsingObject || 'hh' in parsingObject) ) {
+ isPM = true
+ }
+ }
+
+ // Calculate it in minutes and return.
+ return (isPM ? hour + 12 : hour) * MINUTES_IN_HOUR + minutes
+} //TimePicker.prototype.parse
+
+
+/**
+ * Various formats to display the object in.
+ */
+TimePicker.prototype.formats = {
+
+ h: function( string, timeObject ) {
+
+ // If there's string, then get the digits length.
+ // Otherwise return the selected hour in "standard" format.
+ return string ? _.digits( string ) : timeObject.hour % HOURS_TO_NOON || HOURS_TO_NOON
+ },
+ hh: function( string, timeObject ) {
+
+ // If there's a string, then the length is always 2.
+ // Otherwise return the selected hour in "standard" format with a leading zero.
+ return string ? 2 : _.lead( timeObject.hour % HOURS_TO_NOON || HOURS_TO_NOON )
+ },
+ H: function( string, timeObject ) {
+
+ // If there's string, then get the digits length.
+ // Otherwise return the selected hour in "military" format as a string.
+ return string ? _.digits( string ) : '' + ( timeObject.hour % 24 )
+ },
+ HH: function( string, timeObject ) {
+
+ // If there's string, then get the digits length.
+ // Otherwise return the selected hour in "military" format with a leading zero.
+ return string ? _.digits( string ) : _.lead( timeObject.hour % 24 )
+ },
+ i: function( string, timeObject ) {
+
+ // If there's a string, then the length is always 2.
+ // Otherwise return the selected minutes.
+ return string ? 2 : _.lead( timeObject.mins )
+ },
+ a: function( string, timeObject ) {
+
+ // If there's a string, then the length is always 4.
+ // Otherwise check if it's more than "noon" and return either am/pm.
+ return string ? 4 : MINUTES_IN_DAY / 2 > timeObject.time % MINUTES_IN_DAY ? 'a.m.' : 'p.m.'
+ },
+ A: function( string, timeObject ) {
+
+ // If there's a string, then the length is always 2.
+ // Otherwise check if it's more than "noon" and return either am/pm.
+ return string ? 2 : MINUTES_IN_DAY / 2 > timeObject.time % MINUTES_IN_DAY ? 'AM' : 'PM'
+ },
+
+ // Create an array by splitting the formatting string passed.
+ toArray: function( formatString ) { return formatString.split( /(h{1,2}|H{1,2}|i|a|A|!.)/g ) },
+
+ // Format an object into a string using the formatting options.
+ toString: function ( formatString, itemObject ) {
+ var clock = this
+ return clock.formats.toArray( formatString ).map( function( label ) {
+ return _.trigger( clock.formats[ label ], clock, [ 0, itemObject ] ) || label.replace( /^!/, '' )
+ }).join( '' )
+ }
+} //TimePicker.prototype.formats
+
+
+
+
+/**
+ * Check if two time units are the exact.
+ */
+TimePicker.prototype.isTimeExact = function( one, two ) {
+
+ var clock = this
+
+ // When we’re working with minutes, do a direct comparison.
+ if (
+ ( _.isInteger( one ) && _.isInteger( two ) ) ||
+ ( typeof one == 'boolean' && typeof two == 'boolean' )
+ ) {
+ return one === two
+ }
+
+ // When we’re working with time representations, compare the “pick” value.
+ if (
+ ( _.isDate( one ) || $.isArray( one ) ) &&
+ ( _.isDate( two ) || $.isArray( two ) )
+ ) {
+ return clock.create( one ).pick === clock.create( two ).pick
+ }
+
+ // When we’re working with range objects, compare the “from” and “to”.
+ if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) {
+ return clock.isTimeExact( one.from, two.from ) && clock.isTimeExact( one.to, two.to )
+ }
+
+ return false
+}
+
+
+/**
+ * Check if two time units overlap.
+ */
+TimePicker.prototype.isTimeOverlap = function( one, two ) {
+
+ var clock = this
+
+ // When we’re working with an integer, compare the hours.
+ if ( _.isInteger( one ) && ( _.isDate( two ) || $.isArray( two ) ) ) {
+ return one === clock.create( two ).hour
+ }
+ if ( _.isInteger( two ) && ( _.isDate( one ) || $.isArray( one ) ) ) {
+ return two === clock.create( one ).hour
+ }
+
+ // When we’re working with range objects, check if the ranges overlap.
+ if ( $.isPlainObject( one ) && $.isPlainObject( two ) ) {
+ return clock.overlapRanges( one, two )
+ }
+
+ return false
+}
+
+
+/**
+ * Flip the “enabled” state.
+ */
+TimePicker.prototype.flipEnable = function(val) {
+ var itemObject = this.item
+ itemObject.enable = val || (itemObject.enable == -1 ? 1 : -1)
+}
+
+
+/**
+ * Mark a collection of times as “disabled”.
+ */
+TimePicker.prototype.deactivate = function( type, timesToDisable ) {
+
+ var clock = this,
+ disabledItems = clock.item.disable.slice(0)
+
+
+ // If we’re flipping, that’s all we need to do.
+ if ( timesToDisable == 'flip' ) {
+ clock.flipEnable()
+ }
+
+ else if ( timesToDisable === false ) {
+ clock.flipEnable(1)
+ disabledItems = []
+ }
+
+ else if ( timesToDisable === true ) {
+ clock.flipEnable(-1)
+ disabledItems = []
+ }
+
+ // Otherwise go through the times to disable.
+ else {
+
+ timesToDisable.map(function( unitToDisable ) {
+
+ var matchFound
+
+ // When we have disabled items, check for matches.
+ // If something is matched, immediately break out.
+ for ( var index = 0; index < disabledItems.length; index += 1 ) {
+ if ( clock.isTimeExact( unitToDisable, disabledItems[index] ) ) {
+ matchFound = true
+ break
+ }
+ }
+
+ // If nothing was found, add the validated unit to the collection.
+ if ( !matchFound ) {
+ if (
+ _.isInteger( unitToDisable ) ||
+ _.isDate( unitToDisable ) ||
+ $.isArray( unitToDisable ) ||
+ ( $.isPlainObject( unitToDisable ) && unitToDisable.from && unitToDisable.to )
+ ) {
+ disabledItems.push( unitToDisable )
+ }
+ }
+ })
+ }
+
+ // Return the updated collection.
+ return disabledItems
+} //TimePicker.prototype.deactivate
+
+
+/**
+ * Mark a collection of times as “enabled”.
+ */
+TimePicker.prototype.activate = function( type, timesToEnable ) {
+
+ var clock = this,
+ disabledItems = clock.item.disable,
+ disabledItemsCount = disabledItems.length
+
+ // If we’re flipping, that’s all we need to do.
+ if ( timesToEnable == 'flip' ) {
+ clock.flipEnable()
+ }
+
+ else if ( timesToEnable === true ) {
+ clock.flipEnable(1)
+ disabledItems = []
+ }
+
+ else if ( timesToEnable === false ) {
+ clock.flipEnable(-1)
+ disabledItems = []
+ }
+
+ // Otherwise go through the disabled times.
+ else {
+
+ timesToEnable.map(function( unitToEnable ) {
+
+ var matchFound,
+ disabledUnit,
+ index,
+ isRangeMatched
+
+ // Go through the disabled items and try to find a match.
+ for ( index = 0; index < disabledItemsCount; index += 1 ) {
+
+ disabledUnit = disabledItems[index]
+
+ // When an exact match is found, remove it from the collection.
+ if ( clock.isTimeExact( disabledUnit, unitToEnable ) ) {
+ matchFound = disabledItems[index] = null
+ isRangeMatched = true
+ break
+ }
+
+ // When an overlapped match is found, add the “inverted” state to it.
+ else if ( clock.isTimeOverlap( disabledUnit, unitToEnable ) ) {
+ if ( $.isPlainObject( unitToEnable ) ) {
+ unitToEnable.inverted = true
+ matchFound = unitToEnable
+ }
+ else if ( $.isArray( unitToEnable ) ) {
+ matchFound = unitToEnable
+ if ( !matchFound[2] ) matchFound.push( 'inverted' )
+ }
+ else if ( _.isDate( unitToEnable ) ) {
+ matchFound = [ unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted' ]
+ }
+ break
+ }
+ }
+
+ // If a match was found, remove a previous duplicate entry.
+ if ( matchFound ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
+ if ( clock.isTimeExact( disabledItems[index], unitToEnable ) ) {
+ disabledItems[index] = null
+ break
+ }
+ }
+
+ // In the event that we’re dealing with an overlap of range times,
+ // make sure there are no “inverted” times because of it.
+ if ( isRangeMatched ) for ( index = 0; index < disabledItemsCount; index += 1 ) {
+ if ( clock.isTimeOverlap( disabledItems[index], unitToEnable ) ) {
+ disabledItems[index] = null
+ break
+ }
+ }
+
+ // If something is still matched, add it into the collection.
+ if ( matchFound ) {
+ disabledItems.push( matchFound )
+ }
+ })
+ }
+
+ // Return the updated collection.
+ return disabledItems.filter(function( val ) { return val != null })
+} //TimePicker.prototype.activate
+
+
+/**
+ * The division to use for the range intervals.
+ */
+TimePicker.prototype.i = function( type, value/*, options*/ ) {
+ return _.isInteger( value ) && value > 0 ? value : this.item.interval
+}
+
+
+/**
+ * Create a string for the nodes in the picker.
+ */
+TimePicker.prototype.nodes = function( isOpen ) {
+
+ var
+ clock = this,
+ settings = clock.settings,
+ selectedObject = clock.item.select,
+ highlightedObject = clock.item.highlight,
+ viewsetObject = clock.item.view,
+ disabledCollection = clock.item.disable
+
+ return _.node(
+ 'ul',
+ _.group({
+ min: clock.item.min.pick,
+ max: clock.item.max.pick,
+ i: clock.item.interval,
+ node: 'li',
+ item: function( loopedTime ) {
+ loopedTime = clock.create( loopedTime )
+ var timeMinutes = loopedTime.pick,
+ isSelected = selectedObject && selectedObject.pick == timeMinutes,
+ isHighlighted = highlightedObject && highlightedObject.pick == timeMinutes,
+ isDisabled = disabledCollection && clock.disabled( loopedTime ),
+ formattedTime = _.trigger( clock.formats.toString, clock, [ settings.format, loopedTime ] )
+ return [
+ _.trigger( clock.formats.toString, clock, [ _.trigger( settings.formatLabel, clock, [ loopedTime ] ) || settings.format, loopedTime ] ),
+ (function( klasses ) {
+
+ if ( isSelected ) {
+ klasses.push( settings.klass.selected )
+ }
+
+ if ( isHighlighted ) {
+ klasses.push( settings.klass.highlighted )
+ }
+
+ if ( viewsetObject && viewsetObject.pick == timeMinutes ) {
+ klasses.push( settings.klass.viewset )
+ }
+
+ if ( isDisabled ) {
+ klasses.push( settings.klass.disabled )
+ }
+
+ return klasses.join( ' ' )
+ })( [ settings.klass.listItem ] ),
+ 'data-pick=' + loopedTime.pick + ' ' + _.ariaAttr({
+ role: 'option',
+ label: formattedTime,
+ selected: isSelected && clock.$node.val() === formattedTime ? true : null,
+ activedescendant: isHighlighted ? true : null,
+ disabled: isDisabled ? true : null
+ })
+ ]
+ }
+ }) +
+
+ // * For Firefox forms to submit, make sure to set the button’s `type` attribute as “button”.
+ _.node(
+ 'li',
+ _.node(
+ 'button',
+ settings.clear,
+ settings.klass.buttonClear,
+ 'type=button data-clear=1' + ( isOpen ? '' : ' disabled' ) + ' ' +
+ _.ariaAttr({ controls: clock.$node[0].id })
+ ),
+ '', _.ariaAttr({ role: 'presentation' })
+ ),
+ settings.klass.list,
+ _.ariaAttr({ role: 'listbox', controls: clock.$node[0].id })
+ )
+} //TimePicker.prototype.nodes
+
+
+
+
+
+
+
+/**
+ * Extend the picker to add the component with the defaults.
+ */
+TimePicker.defaults = (function( prefix ) {
+
+ return {
+
+ // Clear
+ clear: 'Clear',
+
+ // The format to show on the `input` element
+ format: 'h:i A',
+
+ // The interval between each time
+ interval: 30,
+
+ // Picker close behavior
+ closeOnSelect: true,
+ closeOnClear: true,
+
+ // Classes
+ klass: {
+
+ picker: prefix + ' ' + prefix + '--time',
+ holder: prefix + '__holder',
+
+ list: prefix + '__list',
+ listItem: prefix + '__list-item',
+
+ disabled: prefix + '__list-item--disabled',
+ selected: prefix + '__list-item--selected',
+ highlighted: prefix + '__list-item--highlighted',
+ viewset: prefix + '__list-item--viewset',
+ now: prefix + '__list-item--now',
+
+ buttonClear: prefix + '__button--clear'
+ }
+ }
+})( Picker.klasses().picker )
+
+
+
+
+
+/**
+ * Extend the picker to add the time picker.
+ */
+Picker.extend( 'pickatime', TimePicker )
+
+
+}));
+
+
+
diff --git a/vendor/assets/stylesheets/_normalize.css.scss b/vendor/assets/stylesheets/_normalize.css.scss
new file mode 100644
index 00000000..6d24a385
--- /dev/null
+++ b/vendor/assets/stylesheets/_normalize.css.scss
@@ -0,0 +1,402 @@
+/*! normalize.css v2.1.1 | MIT License | git.io/normalize */
+
+/* ==========================================================================
+ HTML5 display definitions
+ ========================================================================== */
+
+/**
+ * Correct `block` display not defined in IE 8/9.
+ */
+
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+main,
+nav,
+section,
+summary {
+ display: block;
+}
+
+/**
+ * Correct `inline-block` display not defined in IE 8/9.
+ */
+
+audio,
+canvas,
+video {
+ display: inline-block;
+}
+
+/**
+ * Prevent modern browsers from displaying `audio` without controls.
+ * Remove excess height in iOS 5 devices.
+ */
+
+audio:not([controls]) {
+ display: none;
+ height: 0;
+}
+
+/**
+ * Address styling not present in IE 8/9.
+ */
+
+[hidden] {
+ display: none;
+}
+
+/* ==========================================================================
+ Base
+ ========================================================================== */
+
+/**
+ * 1. Prevent system color scheme's background color being used in Firefox, IE,
+ * and Opera.
+ * 2. Prevent system color scheme's text color being used in Firefox, IE, and
+ * Opera.
+ * 3. Set default font family to sans-serif.
+ * 4. Prevent iOS text size adjust after orientation change, without disabling
+ * user zoom.
+ */
+
+html {
+ background: #fff; /* 1 */
+ color: #000; /* 2 */
+ font-family: sans-serif; /* 3 */
+ -ms-text-size-adjust: 100%; /* 4 */
+ -webkit-text-size-adjust: 100%; /* 4 */
+}
+
+/**
+ * Remove default margin.
+ */
+
+body {
+ margin: 0;
+}
+
+/* ==========================================================================
+ Links
+ ========================================================================== */
+
+/**
+ * Address `outline` inconsistency between Chrome and other browsers.
+ */
+
+a:focus {
+ outline: thin dotted;
+}
+
+/**
+ * Improve readability when focused and also mouse hovered in all browsers.
+ */
+
+a:active,
+a:hover {
+ outline: 0;
+}
+
+/* ==========================================================================
+ Typography
+ ========================================================================== */
+
+/**
+ * Address variable `h1` font-size and margin within `section` and `article`
+ * contexts in Firefox 4+, Safari 5, and Chrome.
+ */
+
+h1 {
+ font-size: 2em;
+ margin: 0.67em 0;
+}
+
+/**
+ * Address styling not present in IE 8/9, Safari 5, and Chrome.
+ */
+
+abbr[title] {
+ border-bottom: 1px dotted;
+}
+
+/**
+ * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
+ */
+
+b,
+strong {
+ font-weight: bold;
+}
+
+/**
+ * Address styling not present in Safari 5 and Chrome.
+ */
+
+dfn {
+ font-style: italic;
+}
+
+/**
+ * Address differences between Firefox and other browsers.
+ */
+
+hr {
+ -moz-box-sizing: content-box;
+ box-sizing: content-box;
+ height: 0;
+}
+
+/**
+ * Address styling not present in IE 8/9.
+ */
+
+mark {
+ background: #ff0;
+ color: #000;
+}
+
+/**
+ * Correct font family set oddly in Safari 5 and Chrome.
+ */
+
+code,
+kbd,
+pre,
+samp {
+ font-family: monospace, serif;
+ font-size: 1em;
+}
+
+/**
+ * Improve readability of pre-formatted text in all browsers.
+ */
+
+pre {
+ white-space: pre-wrap;
+}
+
+/**
+ * Set consistent quote types.
+ */
+
+q {
+ quotes: "\201C" "\201D" "\2018" "\2019";
+}
+
+/**
+ * Address inconsistent and variable font size in all browsers.
+ */
+
+small {
+ font-size: 80%;
+}
+
+/**
+ * Prevent `sub` and `sup` affecting `line-height` in all browsers.
+ */
+
+sub,
+sup {
+ font-size: 75%;
+ line-height: 0;
+ position: relative;
+ vertical-align: baseline;
+}
+
+sup {
+ top: -0.5em;
+}
+
+sub {
+ bottom: -0.25em;
+}
+
+/* ==========================================================================
+ Embedded content
+ ========================================================================== */
+
+/**
+ * Remove border when inside `a` element in IE 8/9.
+ */
+
+img {
+ border: 0;
+}
+
+/**
+ * Correct overflow displayed oddly in IE 9.
+ */
+
+svg:not(:root) {
+ overflow: hidden;
+}
+
+/* ==========================================================================
+ Figures
+ ========================================================================== */
+
+/**
+ * Address margin not present in IE 8/9 and Safari 5.
+ */
+
+figure {
+ margin: 0;
+}
+
+/* ==========================================================================
+ Forms
+ ========================================================================== */
+
+/**
+ * Define consistent border, margin, and padding.
+ */
+
+fieldset {
+ border: 1px solid #c0c0c0;
+ margin: 0 2px;
+ padding: 0.35em 0.625em 0.75em;
+}
+
+/**
+ * 1. Correct `color` not being inherited in IE 8/9.
+ * 2. Remove padding so people aren't caught out if they zero out fieldsets.
+ */
+
+legend {
+ border: 0; /* 1 */
+ padding: 0; /* 2 */
+}
+
+/**
+ * 1. Correct font family not being inherited in all browsers.
+ * 2. Correct font size not being inherited in all browsers.
+ * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
+ */
+
+button,
+input,
+select,
+textarea {
+ font-family: inherit; /* 1 */
+ font-size: 100%; /* 2 */
+ margin: 0; /* 3 */
+}
+
+/**
+ * Address Firefox 4+ setting `line-height` on `input` using `!important` in
+ * the UA stylesheet.
+ */
+
+button,
+input {
+ line-height: normal;
+}
+
+/**
+ * Address inconsistent `text-transform` inheritance for `button` and `select`.
+ * All other form control elements do not inherit `text-transform` values.
+ * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
+ * Correct `select` style inheritance in Firefox 4+ and Opera.
+ */
+
+button,
+select {
+ text-transform: none;
+}
+
+/**
+ * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
+ * and `video` controls.
+ * 2. Correct inability to style clickable `input` types in iOS.
+ * 3. Improve usability and consistency of cursor style between image-type
+ * `input` and others.
+ */
+
+button,
+html input[type="button"], /* 1 */
+input[type="reset"],
+input[type="submit"] {
+ -webkit-appearance: button; /* 2 */
+ cursor: pointer; /* 3 */
+}
+
+/**
+ * Re-set default cursor for disabled elements.
+ */
+
+button[disabled],
+html input[disabled] {
+ cursor: default;
+}
+
+/**
+ * 1. Address box sizing set to `content-box` in IE 8/9.
+ * 2. Remove excess padding in IE 8/9.
+ */
+
+input[type="checkbox"],
+input[type="radio"] {
+ box-sizing: border-box; /* 1 */
+ padding: 0; /* 2 */
+}
+
+/**
+ * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
+ * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
+ * (include `-moz` to future-proof).
+ */
+
+input[type="search"] {
+ -webkit-appearance: textfield; /* 1 */
+ -moz-box-sizing: content-box;
+ -webkit-box-sizing: content-box; /* 2 */
+ box-sizing: content-box;
+}
+
+/**
+ * Remove inner padding and search cancel button in Safari 5 and Chrome
+ * on OS X.
+ */
+
+input[type="search"]::-webkit-search-cancel-button,
+input[type="search"]::-webkit-search-decoration {
+ -webkit-appearance: none;
+}
+
+/**
+ * Remove inner padding and border in Firefox 4+.
+ */
+
+button::-moz-focus-inner,
+input::-moz-focus-inner {
+ border: 0;
+ padding: 0;
+}
+
+/**
+ * 1. Remove default vertical scrollbar in IE 8/9.
+ * 2. Improve readability and alignment in all browsers.
+ */
+
+textarea {
+ overflow: auto; /* 1 */
+ vertical-align: top; /* 2 */
+}
+
+/* ==========================================================================
+ Tables
+ ========================================================================== */
+
+/**
+ * Remove most spacing between table cells.
+ */
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0;
+}
diff --git a/vendor/assets/stylesheets/pickadate/default.css b/vendor/assets/stylesheets/pickadate/default.css
new file mode 100644
index 00000000..20cf5cf0
--- /dev/null
+++ b/vendor/assets/stylesheets/pickadate/default.css
@@ -0,0 +1,168 @@
+/* ==========================================================================
+ $BASE-PICKER
+ ========================================================================== */
+/**
+ * Note: the root picker element should *NOT* be styled more than what’s here.
+ */
+.picker {
+ font-size: 16px;
+ text-align: left;
+ line-height: 1.2;
+ color: #000000;
+ position: absolute;
+ z-index: 10000;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+/**
+ * The picker input element.
+ */
+.picker__input {
+ cursor: default;
+}
+/**
+ * When the picker is opened, the input element is “activated”.
+ */
+.picker__input.picker__input--active {
+ border-color: #0089ec;
+}
+/**
+ * The holder is the only “scrollable” top-level container element.
+ */
+.picker__holder {
+ width: 100%;
+ overflow-y: auto;
+ -webkit-overflow-scrolling: touch;
+}
+
+/*!
+ * Default mobile-first, responsive styling for pickadate.js
+ * Demo: http://amsul.github.io/pickadate.js
+ */
+/**
+ * Note: the root picker element should *NOT* be styled more than what’s here.
+ */
+/**
+ * Make the holder and frame fullscreen.
+ */
+.picker__holder,
+.picker__frame {
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ -webkit-transform: translateY(100%);
+ -ms-transform: translateY(100%);
+ transform: translateY(100%);
+}
+/**
+ * The holder should overlay the entire screen.
+ */
+.picker__holder {
+ position: fixed;
+ transition: background 0.15s ease-out, -webkit-transform 0s 0.15s;
+ transition: background 0.15s ease-out, transform 0s 0.15s;
+ -webkit-backface-visibility: hidden;
+}
+/**
+ * The frame that bounds the box contents of the picker.
+ */
+.picker__frame {
+ position: absolute;
+ margin: 0 auto;
+ min-width: 256px;
+ max-width: 666px;
+ width: 100%;
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
+ filter: alpha(opacity=0);
+ -moz-opacity: 0;
+ opacity: 0;
+ transition: all 0.15s ease-out;
+}
+@media (min-height: 33.875em) {
+ .picker__frame {
+ overflow: visible;
+ top: auto;
+ bottom: -100%;
+ max-height: 80%;
+ }
+}
+@media (min-height: 40.125em) {
+ .picker__frame {
+ margin-bottom: 7.5%;
+ }
+}
+/**
+ * The wrapper sets the stage to vertically align the box contents.
+ */
+.picker__wrap {
+ display: table;
+ width: 100%;
+ height: 100%;
+}
+@media (min-height: 33.875em) {
+ .picker__wrap {
+ display: block;
+ }
+}
+/**
+ * The box contains all the picker contents.
+ */
+.picker__box {
+ background: #ffffff;
+ display: table-cell;
+ vertical-align: middle;
+}
+@media (min-height: 26.5em) {
+ .picker__box {
+ font-size: 1.25em;
+ }
+}
+@media (min-height: 33.875em) {
+ .picker__box {
+ display: block;
+ font-size: 1.33em;
+ border: 1px solid #777777;
+ border-top-color: #898989;
+ border-bottom-width: 0;
+ border-radius: 5px 5px 0 0;
+ box-shadow: 0 12px 36px 16px rgba(0, 0, 0, 0.24);
+ }
+}
+@media (min-height: 40.125em) {
+ .picker__box {
+ font-size: 1.5em;
+ border-bottom-width: 1px;
+ border-radius: 5px;
+ }
+}
+/**
+ * When the picker opens...
+ */
+.picker--opened .picker__holder {
+ -webkit-transform: translateY(0);
+ -ms-transform: translateY(0);
+ transform: translateY(0);
+ background: transparent;
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#1E000000,endColorstr=#1E000000)";
+ zoom: 1;
+ background: rgba(0, 0, 0, 0.32);
+ transition: background 0.15s ease-out;
+}
+.picker--opened .picker__frame {
+ -webkit-transform: translateY(0);
+ -ms-transform: translateY(0);
+ transform: translateY(0);
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
+ filter: alpha(opacity=100);
+ -moz-opacity: 1;
+ opacity: 1;
+}
+@media (min-height: 33.875em) {
+ .picker--opened .picker__frame {
+ top: auto;
+ bottom: 0;
+ }
+}
diff --git a/vendor/assets/stylesheets/pickadate/default.date.css b/vendor/assets/stylesheets/pickadate/default.date.css
new file mode 100644
index 00000000..0b297577
--- /dev/null
+++ b/vendor/assets/stylesheets/pickadate/default.date.css
@@ -0,0 +1,301 @@
+/* ==========================================================================
+ $BASE-DATE-PICKER
+ ========================================================================== */
+/**
+ * The picker box.
+ */
+.picker__box {
+ padding: 0 1em;
+}
+/**
+ * The header containing the month and year stuff.
+ */
+.picker__header {
+ text-align: center;
+ position: relative;
+ margin-top: .75em;
+}
+/**
+ * The month and year labels.
+ */
+.picker__month,
+.picker__year {
+ font-weight: 500;
+ display: inline-block;
+ margin-left: .25em;
+ margin-right: .25em;
+}
+.picker__year {
+ color: #999999;
+ font-size: .8em;
+ font-style: italic;
+}
+/**
+ * The month and year selectors.
+ */
+.picker__select--month,
+.picker__select--year {
+ border: 1px solid #b7b7b7;
+ height: 2em;
+ padding: .5em;
+ margin-left: .25em;
+ margin-right: .25em;
+}
+@media (min-width: 24.5em) {
+ .picker__select--month,
+ .picker__select--year {
+ margin-top: -0.5em;
+ }
+}
+.picker__select--month {
+ width: 35%;
+}
+.picker__select--year {
+ width: 22.5%;
+}
+.picker__select--month:focus,
+.picker__select--year:focus {
+ border-color: #0089ec;
+}
+/**
+ * The month navigation buttons.
+ */
+.picker__nav--prev,
+.picker__nav--next {
+ position: absolute;
+ padding: .5em 1.25em;
+ width: 1em;
+ height: 1em;
+ box-sizing: content-box;
+ top: -0.25em;
+}
+@media (min-width: 24.5em) {
+ .picker__nav--prev,
+ .picker__nav--next {
+ top: -0.33em;
+ }
+}
+.picker__nav--prev {
+ left: -1em;
+ padding-right: 1.25em;
+}
+@media (min-width: 24.5em) {
+ .picker__nav--prev {
+ padding-right: 1.5em;
+ }
+}
+.picker__nav--next {
+ right: -1em;
+ padding-left: 1.25em;
+}
+@media (min-width: 24.5em) {
+ .picker__nav--next {
+ padding-left: 1.5em;
+ }
+}
+.picker__nav--prev:before,
+.picker__nav--next:before {
+ content: " ";
+ border-top: .5em solid transparent;
+ border-bottom: .5em solid transparent;
+ border-right: 0.75em solid #000000;
+ width: 0;
+ height: 0;
+ display: block;
+ margin: 0 auto;
+}
+.picker__nav--next:before {
+ border-right: 0;
+ border-left: 0.75em solid #000000;
+}
+.picker__nav--prev:hover,
+.picker__nav--next:hover {
+ cursor: pointer;
+ color: #000000;
+ background: #b1dcfb;
+}
+.picker__nav--disabled,
+.picker__nav--disabled:hover,
+.picker__nav--disabled:before,
+.picker__nav--disabled:before:hover {
+ cursor: default;
+ background: none;
+ border-right-color: #f5f5f5;
+ border-left-color: #f5f5f5;
+}
+/**
+ * The calendar table of dates
+ */
+.picker__table {
+ text-align: center;
+ border-collapse: collapse;
+ border-spacing: 0;
+ table-layout: fixed;
+ font-size: inherit;
+ width: 100%;
+ margin-top: .75em;
+ margin-bottom: .5em;
+}
+@media (min-height: 33.875em) {
+ .picker__table {
+ margin-bottom: .75em;
+ }
+}
+.picker__table td {
+ margin: 0;
+ padding: 0;
+}
+/**
+ * The weekday labels
+ */
+.picker__weekday {
+ width: 14.285714286%;
+ font-size: .75em;
+ padding-bottom: .25em;
+ color: #999999;
+ font-weight: 500;
+ /* Increase the spacing a tad */
+}
+@media (min-height: 33.875em) {
+ .picker__weekday {
+ padding-bottom: .5em;
+ }
+}
+/**
+ * The days on the calendar
+ */
+.picker__day {
+ padding: .3125em 0;
+ font-weight: 200;
+ border: 1px solid transparent;
+}
+.picker__day--today {
+ position: relative;
+}
+.picker__day--today:before {
+ content: " ";
+ position: absolute;
+ top: 2px;
+ right: 2px;
+ width: 0;
+ height: 0;
+ border-top: 0.5em solid #0059bc;
+ border-left: .5em solid transparent;
+}
+.picker__day--disabled:before {
+ border-top-color: #aaaaaa;
+}
+.picker__day--outfocus {
+ color: #dddddd;
+}
+.picker__day--infocus:hover,
+.picker__day--outfocus:hover {
+ cursor: pointer;
+ color: #000000;
+ background: #b1dcfb;
+}
+.picker__day--highlighted {
+ border-color: #0089ec;
+}
+.picker__day--highlighted:hover,
+.picker--focused .picker__day--highlighted {
+ cursor: pointer;
+ color: #000000;
+ background: #b1dcfb;
+}
+.picker__day--selected,
+.picker__day--selected:hover,
+.picker--focused .picker__day--selected {
+ background: #0089ec;
+ color: #ffffff;
+}
+.picker__day--disabled,
+.picker__day--disabled:hover,
+.picker--focused .picker__day--disabled {
+ background: #f5f5f5;
+ border-color: #f5f5f5;
+ color: #dddddd;
+ cursor: default;
+}
+.picker__day--highlighted.picker__day--disabled,
+.picker__day--highlighted.picker__day--disabled:hover {
+ background: #bbbbbb;
+}
+/**
+ * The footer containing the "today", "clear", and "close" buttons.
+ */
+.picker__footer {
+ text-align: center;
+}
+.picker__button--today,
+.picker__button--clear,
+.picker__button--close {
+ border: 1px solid #ffffff;
+ background: #ffffff;
+ font-size: .8em;
+ padding: .66em 0;
+ font-weight: bold;
+ width: 33%;
+ display: inline-block;
+ vertical-align: bottom;
+}
+.picker__button--today:hover,
+.picker__button--clear:hover,
+.picker__button--close:hover {
+ cursor: pointer;
+ color: #000000;
+ background: #b1dcfb;
+ border-bottom-color: #b1dcfb;
+}
+.picker__button--today:focus,
+.picker__button--clear:focus,
+.picker__button--close:focus {
+ background: #b1dcfb;
+ border-color: #0089ec;
+ outline: none;
+}
+.picker__button--today:before,
+.picker__button--clear:before,
+.picker__button--close:before {
+ position: relative;
+ display: inline-block;
+ height: 0;
+}
+.picker__button--today:before,
+.picker__button--clear:before {
+ content: " ";
+ margin-right: .45em;
+}
+.picker__button--today:before {
+ top: -0.05em;
+ width: 0;
+ border-top: 0.66em solid #0059bc;
+ border-left: .66em solid transparent;
+}
+.picker__button--clear:before {
+ top: -0.25em;
+ width: .66em;
+ border-top: 3px solid #ee2200;
+}
+.picker__button--close:before {
+ content: "\D7";
+ top: -0.1em;
+ vertical-align: top;
+ font-size: 1.1em;
+ margin-right: .35em;
+ color: #777777;
+}
+.picker__button--today[disabled],
+.picker__button--today[disabled]:hover {
+ background: #f5f5f5;
+ border-color: #f5f5f5;
+ color: #dddddd;
+ cursor: default;
+}
+.picker__button--today[disabled]:before {
+ border-top-color: #aaaaaa;
+}
+
+/* ==========================================================================
+ $DEFAULT-DATE-PICKER
+ ========================================================================== */
diff --git a/vendor/assets/stylesheets/pickadate/default.time.css b/vendor/assets/stylesheets/pickadate/default.time.css
new file mode 100644
index 00000000..624a7549
--- /dev/null
+++ b/vendor/assets/stylesheets/pickadate/default.time.css
@@ -0,0 +1,126 @@
+/* ==========================================================================
+ $BASE-TIME-PICKER
+ ========================================================================== */
+/**
+ * The list of times.
+ */
+.picker__list {
+ list-style: none;
+ padding: 0.75em 0 4.2em;
+ margin: 0;
+}
+/**
+ * The times on the clock.
+ */
+.picker__list-item {
+ border-bottom: 1px solid #dddddd;
+ border-top: 1px solid #dddddd;
+ margin-bottom: -1px;
+ position: relative;
+ background: #ffffff;
+ padding: .75em 1.25em;
+}
+@media (min-height: 46.75em) {
+ .picker__list-item {
+ padding: .5em 1em;
+ }
+}
+/* Hovered time */
+.picker__list-item:hover {
+ cursor: pointer;
+ color: #000000;
+ background: #b1dcfb;
+ border-color: #0089ec;
+ z-index: 10;
+}
+/* Highlighted and hovered/focused time */
+.picker__list-item--highlighted {
+ border-color: #0089ec;
+ z-index: 10;
+}
+.picker__list-item--highlighted:hover,
+.picker--focused .picker__list-item--highlighted {
+ cursor: pointer;
+ color: #000000;
+ background: #b1dcfb;
+}
+/* Selected and hovered/focused time */
+.picker__list-item--selected,
+.picker__list-item--selected:hover,
+.picker--focused .picker__list-item--selected {
+ background: #0089ec;
+ color: #ffffff;
+ z-index: 10;
+}
+/* Disabled time */
+.picker__list-item--disabled,
+.picker__list-item--disabled:hover,
+.picker--focused .picker__list-item--disabled {
+ background: #f5f5f5;
+ border-color: #f5f5f5;
+ color: #dddddd;
+ cursor: default;
+ border-color: #dddddd;
+ z-index: auto;
+}
+/**
+ * The clear button
+ */
+.picker--time .picker__button--clear {
+ display: block;
+ width: 80%;
+ margin: 1em auto 0;
+ padding: 1em 1.25em;
+ background: none;
+ border: 0;
+ font-weight: 500;
+ font-size: .67em;
+ text-align: center;
+ text-transform: uppercase;
+ color: #666;
+}
+.picker--time .picker__button--clear:hover,
+.picker--time .picker__button--clear:focus {
+ color: #000000;
+ background: #b1dcfb;
+ background: #ee2200;
+ border-color: #ee2200;
+ cursor: pointer;
+ color: #ffffff;
+ outline: none;
+}
+.picker--time .picker__button--clear:before {
+ top: -0.25em;
+ color: #666;
+ font-size: 1.25em;
+ font-weight: bold;
+}
+.picker--time .picker__button--clear:hover:before,
+.picker--time .picker__button--clear:focus:before {
+ color: #ffffff;
+ border-color: #ffffff;
+}
+
+/* ==========================================================================
+ $DEFAULT-TIME-PICKER
+ ========================================================================== */
+/**
+ * The frame the bounds the time picker.
+ */
+.picker--time .picker__frame {
+ min-width: 256px;
+ max-width: 320px;
+}
+/**
+ * The picker box.
+ */
+.picker--time .picker__box {
+ font-size: 1em;
+ background: #f2f2f2;
+ padding: 0;
+}
+@media (min-height: 40.125em) {
+ .picker--time .picker__box {
+ margin-bottom: 5em;
+ }
+}