lanejs is a Ruby on Rails like MVC framework for javascript written in coffeescript. You can use it for SEO friendly pages.
namespace "DaWanda.Models.Message", ->
class Message extends Lib.Model
@attrAccessible "subject", "text", "from", "to", "image_field", "hidden", "subject_type", "subject_id"
@validates "from", presence: true
@validates "subject", presence: true
@validates "text", presence: true
@validates "to", presence: true
@validates "image_field", format:
with: /.*\.(jpg|jpeg|png|gif)$/i
message: I18n.t("errors.messages.file_format_invalid")
# Use Crud to load and save data from JSON
@extend Lib.Crud
@resource "message"
@endpoint "/core/messages"
namespace "DaWanda.Controllers.MessagesController", ->
class MessagesController extends Lib.Controller
@beforeFilter '_doSomething'
index: ->
@messages = [new DaWanda.Models.Message(from: "me", to: "you", subject: "i like you", text: "really <3")]
new: ->
@message = new DaWanda.Models.Message()
edit: ->
DaWanda.Models.Message.find(id: @params["id"]).done ( message ) =>
@message = message
_doSomething: ->
# TODO
Lib.Router.draw ->
@match "/foo/:id", "foo#show"
# Map a resource (will look for UsersController
# and map index, show, new and update actions)
@resources "users", ->
# You can add additional members/collection actions
@member "profile"
@collection "top_influencers"
# You can nest resources too
@resources "shops", ->
@resources "products"
# Map a singular resource (will look for CartController
# and map show, new and edit actions)
@resource "cart"
Use with rails-assets.org
Change your gemfile so it looks like:
source 'https://rails-assets.org'
gem 'rails-assets-lanejs'
For building and testing it is neccessary to install npm and run npm install --dev
.
It is recommended to install the grunt-cli and karma-cli tool:
npm install -g grunt-cli
npm install -g karma-cli
To install the runtime dependencies and build the project just run grunt build
.
Tests are running with karma.js and are built with jasmine.
karma start
- Ensure the bug can be reproduced on the latest master.
- Open an issue on GitHub and include an isolated JSFiddle demonstration of the bug. The more information you provide, the easier it will be to validate and fix.
- Fork the repository and create a topic branch.
- Be sure to associate commits to their corresponding issue using
[#1]
or[Closes #1]
if the commit resolves the issue. - Make sure not to commit any changes under
dist/
as they will surely cause merge conflicts later. Files underdist/
are only committed when a new build is released. - Include tests for your changes and make them pass.
- Push to your fork and submit a pull-request with an explanation and reference to the issue number(s).