Commit graph

41 commits

Author SHA1 Message Date
Leo Horie
cd8b8b12e6 Some documentation 2016-05-19 01:22:01 -04:00
Leo Horie
13fdb60f66 clean slate 2016-04-20 20:01:04 -04:00
pelonpelon
dc36588160 components.md - eliminate global variable introduced in previous commit
Oops!
2015-07-07 09:04:08 -05:00
pelonpelon
7ce8429bf4 Update components.md -- "Classic MVC" example
@ArthurClemens pointed out in this gitter comment:
https://gitter.im/lhorie/mithril.js?at=55664ba1d21e5ed02ff06e54
that the Classic MVC example is broken:
https://lhorie.github.io/mithril/components.html#classic-mvc

I wanted to show a working jsfiddle with these changes applied, but I couldn't figure out how to get a POST request working. I do, however, have a jsbin that is working, although there are significant changes in the code to allow for GET and POST.
http://jsbin.com/cokesu/2/edit?js,output

A redraw is called for every character entered in the jsbin but AFAICT, not in this PR. I don't know why. It's as though `oninput` is really `onchange`. It's possible to limit the redraw to once when the "save" button is clicked, but this requires a change in logic:

var ContactForm = {
    controller: function(args) {
        this.contact = m.prop(new Contact())
        this.save = function(contact) {
           Observable.trigger("saveContact", {contact: contact})
        }
    },
    view: function(ctrl, args) {
        var contact = ctrl.contact()

        return m("form", [
            m("label", "Name"),
            m("input[name=name]"),

            m("label", "Email"),
            m("input[name=email]"),

            m("button[type=button]", {onclick: function(){
              contact = {
                name: m.prop(this.parentNode.elements.name.value),
                email: m.prop(this.parentNode.elements.email.value)
              }
              ctrl.save(contact)
            
            }}, "Save")
        ])
    }
}
2015-05-28 03:47:40 -05:00
Daniel Loomer
c622283877 components.md 'trigger', not 'broadcast' 2015-05-07 15:54:51 -04:00
Yoshiki Shibukawa
39c3118070 Update components.md
Fix sample code. Contact.list() should return a list of Contact instances.
2015-05-02 07:49:02 +09:00
Leo Horie
5a786009c5 remove references to m.module 2015-04-22 21:18:41 -04:00
Leo Horie
4d03595bb1 example 2015-04-13 22:17:00 -04:00
Leo Horie
9e8dc6998d rework api 2015-04-09 22:44:45 -04:00
Leo Horie
6abb868c6b remove stuff that got moved to api page 2015-04-06 22:54:00 -04:00
Leo Horie
d5619d412e changes in the docs: rename modules to components, change idiomatic controller and view usage 2015-04-06 22:41:38 -04:00
Steven Loria
946ebeeb42 Add missing ctrl argument 2015-03-22 18:32:13 -04:00
Steven Loria
3b012187c0 Consistently use args for arguments passed to a module 2015-03-22 18:07:46 -04:00
Steven Loria
c267114f06 Correction to "Aggregation of resp." example 2015-03-22 18:06:43 -04:00
Leo Horie
4632a61959 fix observer code example 2015-03-18 23:22:43 -04:00
Leo Horie
5011dd97b6 more docs about component-based architecture 2015-03-17 23:04:05 -04:00
Leo Horie
fd1090f9d8 Merge branch 'comp-doc-fixes' of https://github.com/leeoniya/mithril.js into leeoniya-comp-doc-fixes
Conflicts:
	docs/components.md
2015-03-17 09:00:02 -04:00
Leo Horie
24695d4cc3 Merge pull request #490 from barneycarroll/patch-1
Code typo in `unload` documentation
2015-03-17 08:55:37 -04:00
Barney Carroll
837c0241cc Fixed uploader demo code
Still needs styling for the drop area to occupy any space though. Worth putting in as inline styles?
2015-03-17 09:06:09 +00:00
Barney Carroll
7585d9e5a3 Code typo in unload documentation 2015-03-17 08:24:07 +00:00
Leon Sorokin
f0c0c3c0be fix drag-n-drop uploader docs 2015-03-16 23:43:22 -05:00
Leo Horie
0ea9fac07e add example to docs 2015-03-16 23:28:38 -04:00
Leo Horie
bdff136e9a ordered lists 2015-03-16 23:09:16 -04:00
Leo Horie
5a64e56a03 beefing up components docs 2015-03-16 22:58:31 -04:00
Leo Horie
0f45d22448 improve docs 2015-03-13 22:52:34 -04:00
Leo Horie
90843f6bdb add docs about async components 2015-02-26 22:51:07 -05:00
Leo Horie
0d819f082b ordered list in docs 2015-02-18 22:05:52 -05:00
Leo Horie
8fadeadb8f some docs 2015-02-18 21:59:54 -05:00
Keenan Lidral-Porter
e690134478 replace new function pattern with IIFE and fixes errors in example code 2014-12-07 15:14:38 -08:00
Leo Horie
cf3b77c161 docs and macro fix 2014-10-29 09:19:02 -04:00
Leo Horie
bfd043aa5e guide updates 2014-10-01 22:17:49 -04:00
Leo Horie
4184da27c8 update docs about components 2014-09-26 21:42:36 -04:00
Leo Horie
9bd0585b41 improving components docs 2014-09-25 07:25:51 -04:00
nickolasgregory
46e8ffc627 tweaked example components setter-getter
Pass the function, not the returned object, to the autocompleter component.
Allows `dashboard` to pass results from `m.request()` - Tested OK
2014-09-15 20:01:14 +10:00
Leo Horie
9a00707eeb fix console.log higher-order calls in docs 2014-07-22 16:39:35 -04:00
eddyystop
3961d70322 Correcting a code example. 2014-05-30 13:36:19 -04:00
David Niergarth
9ea782f759 Copy edit docs 2014-05-26 23:51:16 -05:00
Leo Horie
c1f6705a59 fix docs 2014-04-29 22:17:21 -04:00
Leo Horie
232b02a082 fix autocompleter example in docs 2014-04-06 22:09:20 -04:00
Leo Horie
08798bd6af fix typo in components docs 2014-03-22 17:38:53 -04:00
Leo Horie
70b2489539 initial release 2014-03-16 22:07:53 -04:00