6. Rails + Backbone.js ⢠ãã³ãã¬ã¼ãã«ERB + Mustacheã 使ãããµã¼ãã¨ã¯ã©ã¤ã¢ã³ãã§ä¸é¨ã å ±æã ⢠ã¯ã©ã¤ã¢ã³ãå´JavaScriptã®ã³ã¼ã éããï¼å²ããããå ããããã«ãª ãã
6. Rails + Backbone.js ⢠ãã³ãã¬ã¼ãã«ERB + Mustacheã 使ãããµã¼ãã¨ã¯ã©ã¤ã¢ã³ãã§ä¸é¨ã å ±æã ⢠ã¯ã©ã¤ã¢ã³ãå´JavaScriptã®ã³ã¼ã éããï¼å²ããããå ããããã«ãª ãã
ã ãã¶åã«æ¸ãã Backbone.js ã®å ¥éè¨äºã§ Backbone.Router ã使ã£ããµã³ãã«ãç´¹ä»ããã ä½ã£ã¦è¦ãã Backbone.js (2) Router ç·¨ - present Router ã表示ãã View ãåãæ¿ããè¯ãæ¹æ³ãæãã¤ããªãã£ãã®ã§ããµã³ãã«ã§ã¯ã¡ã¤ã³ View ãã°ãã¼ãã«å¤æ°ã«æ ¼ç´ã㦠Router ãã触ããããã«ããç¡çããåãæ¿ãã¦ãããä»è¦ã¦ããå ¨ç¶ã¹ãã¼ããªæ¹æ³ãããªããã ãããã試è¡é¯èª¤ããªãããä½åã Backbone.js ã使ã£ã¦ã¢ããªãä½æãã¦ã¿ã¦ãããããèªåã®ä¸ã§ Backbone.Router ã®ä½¿ãæ¹ãåºã¾ã£ãã以åæ¸ãããµã³ãã«ãä¿®æ£ããã®ããã¡ãã <!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8"> <title>Backbone
Backbone.jsã¨ã¯ï¼ Backbone.jsã¯ãJavaScriptã«ãã大è¦æ¨¡ãªã¢ããªã±ã¼ã·ã§ã³éçºãè¡ãéã«åãçºæ®ããMVCãã¬ã¼ã ã¯ã¼ã¯ã§ãããã¼ã¿ãã¤ã³ãã£ã³ã°ã¨ã«ã¹ã¿ã ã¤ãã³ããåããModelãé åæ å ±ã表ãCollectionãã¤ãã³ãããã³ããªã³ã°ããViewããµã¼ãã¼ãµã¤ãã®ã¢ããªã±ã¼ã·ã§ã³ã¨é£æºããããã®RESTful JSONãªã©ããã¬ã¼ã ã¯ã¼ã¯ã¨ãã¦åãã¦ãã¾ãã 大è¦æ¨¡ãªæ¥åã¢ããªã±ã¼ã·ã§ã³ã®ã¦ã¼ã¶ã¼ã¤ã³ã¿ãã§ã¼ã¹ãJavaScriptã§ã´ãªã´ãªã¨ä½ããã¨ããå ´åã100%ã«è¿ã確çã§å¤±æãããã¨æãã¾ããããã¯ãFlexã®ãããªãã«ãæã®ã³ã³ãã¤ã©ã¨ã©ã¼ãæ¤åºã§ããªããã¨ãåå¨ãããã¬ã¼ã ã¯ã¼ã¯ãã¤ã³ã¿ã©ã¯ã·ã§ã³ããã¸ã¥ã¢ã«ã«ç¹åãã¦ãããã¨ããã©ã¦ã¶ã¼ãOSã®çµåãã§APIã¬ãã«ã®ä»æ§ãç°ãªãäºãåããã©ã¦ã¶ã¼ã§ããã¼ã¸ã§ã³ã®éãã«ããæåãç°ãªãäº
Mackbone.Modelã®æ´¾çã¯ã©ã¹ã¯ãããã©ã«ãã§Ajaxã«ãããµã¼ãã¨ã®é£æºãã§ããã åã®ã¨ã³ããªã§ãæ¸ããã®ã ãã©ãfetch(), save(), destory()ãã®3ã¤ã®ã¡ã½ããã使ãã ãã®ï¼ã¤ã®ã¡ã½ãããããBackbone.sync()ãå¼ã°ãã$.ajax()ç¨ã«ãªãã·ã§ã³å¦çãããããã®ä¸ã§ã¯ãµã¼ãã¼å´ã¢ããªã±ã¼ã·ã§ã³ã®è¦ä»¶ã«å¿ãã¦ãBackbone.emulateHTTPãBackbone.emulateJSON ã¨ãããã©ã°ãæ´»ç¨ããå¤ãå®è£ ã§ã®ã¢ããªã±ã¼ã·ã§ã³ã«ã対å¿ããããããæ§åã Modelã«å®è£ ãããããµã¼ãã¼é£æºç¨ã¡ã½ããã¯ï¼ã¤ã model.fetch() ãµã¼ãã¼ããèªããmodel.save() ãµã¼ãã¼ã«æ¸ãè¾¼ããmodel.destroy() ãµã¼ãã¼ããåé¤ããã ãã®ï¼ã¤ã¯ãModelã®æ´¾çã¯ã©ã¹ã«sync() ãå®è£ ããå ´åã¯ã
ã¢ãã¤ã«ç Basecamp ã«ä½¿ããã¦ããã¨èãã¦èå³ãæ±ãã¦ãããJavaScript ã® MVC ãã¬ã¼ã ã¯ã¼ã¯ Backbone.jsãModel 㨠View ã¯å æ¥è©¦ãã¾ããã ä½ã£ã¦è¦ãã Backbone.js - present ã§ããController ã¯ã¾ã ããä»åº¦è©¦ããã¨ãã£ã¦ãããªããã¨ãå¤ãç§ã§ããã©ãController ã¯èªåã使ãã®ã§ãã¡ããã¨è¡åã«ç§»ããã¨ã«ãã¾ãã Backbone ã§ã¯ Controller ã®å½¹å²ã¯ Backbone.Router ãç¶æ¿ããã¯ã©ã¹ãè¡ãã¾ããRouterã®å®ç¾©ã®ä»æ¹ã¯ãããªæãã var AppRouter = Backbone.Router.extend({ routes: { "post/": "list", "post/:id": "show" }, list: function() { # ãã¼ã¿ä¸è¦§ã表
events ã¨ã default ã¨ã¯ä½ã Backbone.js ã®ã¯ã©ã¹å®ç¾©ã«ããã¦ãç¹æ®ãªãã©ã¡ã¼ã¿ã¼ãããã¤ãåå¨ãã¦ããããã¨ãã° events ã defaults ã¯ã Backbone.js ã®ãã¥ã¼ããªã¢ã«çææ¸ã§ã¯ã¾ã£ããã«è§¦ãããã¦ããç¹æ®ãªãã©ã¡ã¼ã¿ã¼ã ã ä¾ãã°ã defaults 㯠Model ã®ç¹æ®ãã©ã¡ã¼ã¿ã¼ã§ãæå®ãã¦ãããã¨ã§ã¯ã©ã¹ãã¤ã³ã¹ã¿ã³ã¹åããéã«ãããã©ã«ãã®å¤ã¨ãã¦ä½¿ãããããã«ãªãã var Person = Backbone.Model.extend({ defaults: { name: 'John Doe', age: 25 } }); var person = new Person({ age: 100 }); person.get('name'); // 'John Doe' person.get('age'); // 100
Backbone.js ã試ãããã Knockout.js ã«ãææ¦ JavaScript ã®ã¯ã©ã¤ã¢ã³ã MVC ãã¬ã¼ã ã¯ã¼ã¯ã¯ Backbone.js ã§ãããã¨æã£ã¦ãããã§ãããKnockout.js ã Ver 2.0 ã§ããªãæ©è½è¿½å ããã¦ãã¡ãã£ã¨å¿å¤ããããã¨ã㨠Knockout.js ã®ãã¼ã¿ãã¤ã³ãã£ã³ã°æ©è½ã«èå³ãæã£ã¦ããã¨ããã«ããã³ãã¬ã¼ãæ©è½ã追å ããã¦ã試ãã¦ã¿ãããªãã¾ããã 念ã®ãã説æããã¨ãKnockout.js ã¯ã.NET éçºè ã«ã¯ã馴æã¿ã®ããã¼ã¿ãã¤ã³ãã£ã³ã°ã MVVM ãã¿ã¼ã³ãç¹å¾´ã®ãã¬ã¼ã ã¯ã¼ã¯ã§ãã Knockout : Home ã¡ãªã¿ã«ãBackbone.js ã®è¨äºã¯ãã¡ãã ä½ã£ã¦è¦ãã Backbone.js - present ä½ã£ã¦è¦ãã Backbone.js (2) Router ç·¨ - present T
jQuery ã ãã§ãµã¤ããä½ã£ã¦ããã¨ã¡ãã£ã¨è¦æ¨¡ã大ãããªãã¨è¦ãè¾ããªã£ã¦ããã®ã§ Backbone.js ã使ããã¨æãæ å ±åéãã¦ããã 以ä¸èªåã®çºã®ãªã³ã¯éã ãªãã£ã·ã£ã«ãµã¤ãã®ããã¥ã¡ã³ã http://documentcloud.github.com/backbone/ ãã¥ã¼ããªã¢ã« ãªãã£ã·ã£ã«ã® ToDo ã¢ããªã±ã¼ã·ã§ã³ http://documentcloud.github.com/backbone/docs/todos.html ä¸è¨ã® ToDo ã ã¨æåã®ä¸æ©ã¨ãã¦ã¯è¤éãããã ãã£ã¡ã®æ¹ãåãããããã£ãã Hello Backbonejs â Artur Adib æ¥æ¬èªã¯ Qiita ã®ã¢ããã³ãã«ã¬ã³ãã¼ãåãããããã Backbone.js Advent Calendar 2011 - Qiita WebSocket ã¨ããã SocketI
Backbone.js Introduction Events â bind â unbind â trigger Model â extend â constructor / initialize â get â set â unset â id â cid â attributes - toJSON â save â destroy â validate â url â clone â isNew â change â hasChanged â changedAttributes â previous â previousAttributes Collection â extend â constructor / initialize â models â Underscore Methods (24) â add â remove â get â getByCid â at â le
URLYou can post either your article on Qiita or your blog post. About reserved postingIf you register a secret article by the day before the same day, it will be automatically published around 7:00 on the same day. About posting periodOnly articles submitted after November 1 of the year can be registered. (Secret articles can be registered anytime articles are posted.)
ã¯ããã« Backbone.js ã使ã£ã¦ UI ãå®è£ ãã¦ãããã©ãã¢ãã«ããã¥ã¼ãå¢ãã¦ããã1ãã¡ã¤ã«ã«åããã«ã¯å¤ããã§ããã¡ã¤ã«ãåå²ãã¦å®è£ ããæçµçã«ã¯çµåãããã ããã§ãRequireJS ã使ã£ã¦ã¢ãã«ããã¥ã¼ãã¢ã¸ã¥ã¼ã«ã«ãã¦ããã¡ã¤ã«ãåå²ãã¤ã¤éçºã§ããããã«ãã¦ã¿ãã RequireJS ã¨ã¯ RequireJS 㯠JavaScript ã®ãã¡ã¤ã«ãã¢ã¸ã¥ã¼ã«ãéåæã§ãã¼ãã§ãã JavaScript ã©ã¤ãã©ãªã RequireJS æé©åæ©è½ããããå ¬éæã¯ã¢ã¸ã¥ã¼ã«ãã²ã¨ã¾ã¨ãã«ã§ããã RequireJS 㨠Backbone.js ãçµã¿åããã¦ã¿ã 以åä½ã£ã TODO ã¢ããªã®ãµã³ãã«ã§ç·´ç¿ãã¦ã¿ããã¢ãã«ã¨ãã¥ã¼ã¨ãã³ãã¬ã¼ãã1ãã¡ã¤ã«ã«è¨è¿°ãã¦ããã®ã§ããããå¥ãã¡ã¤ã«ã«åå²ããã ãã£ã¬ã¯ããªæ§æ RequireJS ã®å°å ¥ã§ãã£ã¬ã¯ã
Backbone's only hard dependency is Underscore.js ( >= 1.8.3). For RESTful persistence and DOM manipulation with Backbone.View, include jQuery ( >= 1.11.0). (Mimics of the Underscore and jQuery APIs, such as Lodash and Zepto, will also tend to work, with varying degrees of compatibility.) Getting Started When working on a web application that involves a lot of JavaScript, one of the first things yo
ã¯ãã©ããï½ãJapanese Schoolgirlsã好ããªã¨ã³ã¸ãã¢ã®åç°ã§ãã 以åãjQuery.tmpl() 㧠HTML ã® View 㨠Model ãåé¢ãã¦ã¿ãããã¨ãã è¨äºãæ¸ãã¾ããããå¼ãç¶ãJavaScriptã«ããMVCã·ãªã¼ãºç¬¬äºå¼¾ï¼ ä»åã¯ãBackbone.jsã§Viewã¨Modelãåé¢ããã¦ã¿ãã¨ãã試ã¿ã§ãã ããæè¿ãJavaScriptã®MVCã©ã¤ãã©ãªã ã¨ãJavaScriptMVCãããKnockout.jsã ãBackbone.jsããªã©ãã¼ã¡ã¼ã¡ã¨ç¥å度ãæãã¦ãã¦ãããããªå°è±¡ã§ãã (â»æ³¨)æ£ç¢ºã«ã¯Knockout.jsã¯MVCã§ã¯ãªãMVVM(Model-View-ViewModel)ã§ããã ãããªä¸SoundCloudãªã©ã§ã使ç¨ããã¦ããBackbone.jsãã¨ã¦ãæ°ã«ãªã£ã¦ ããã®ã§ãã©ã®ãããªæãã§å©ç¨ã§ããã®ã試ã
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}