Commits

Kenneth Jørgensen  committed de48e80

Basic Set implementation and added automatic unbinding of the Riverts.View in RivetsHelper

  • Participants
  • Parent commits 8ef7bb5

Comments (0)

Files changed (7)

File CHANGELOG.md

+# Changelog
+
+## 0.2.0 (dev)
+* *Feature:* Basic `Collection` implementation.
+* *Feature:* Basic `Set` implementation.
+* *Feature:* Basic `Map` implementation.
+* *Feature:* Removed `Models` default recursive JSON serialization.
+* *Feature:* Implemented default functions in `Model`.
+* *Fix:* Added automatic unbinding of the `Rivets.View` instance in `RivetsHelper`.
+
+## 0.1.1 (2013-06-27)
+
+* *Fix:* Fixed bug where adding presenters in the `init()` method when extending `Presenter` would not work.
+
+## 0.1.0 (2013-06-26)
+
+* *Feature:* Simple routing using [crossroads.js](http://millermedeiros.github.io/crossroads.js/).

File Gruntfile.coffee

 	"src/ObjectUtil.coffee"
 	"src/Model.coffee"
 	"src/Collection.coffee"
+	"src/Set.coffee"
 	"src/Map.coffee"
 	"src/HelperBroker.coffee"
 	"src/helpers/RivetsHelper.coffee"
+Antifreeze is an [model-view-presenter](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter) client-side UI framework.

File package.json

 {
 	"fullname": "Antifreeze",
 	"name": "antifreeze",
-	"version": "0.1.2-dev",
+	"version": "0.2.0-dev",
 	"description": "Client-side MVP framework.",
 	"keywords": ["mvp", "model-view-presenter", "client", "framework", "ui"],
 	"homepage": "https://bitbucket.org/kennethjor/antifreeze",

File readme.md

-Antifreeze is an [model-view-presenter](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter) client-side UI framework.
-
-# Changelog
-
-## 0.1.2-dev
-
-* Basic `Map` implementation.
-* Basic `Collection` implementation.
-* Removed `Models` default recursive JSON serialization.
-* Implemented default functions in `Model`.
-
-## 0.1.1 (2013-06-27)
-
-* Fixed bug where adding presenters in the `init()` method when extending `Presenter` would not work.
-
-## 0.1.0 (2013-06-26)
-
-* Simple routing using [crossroads.js](http://millermedeiros.github.io/crossroads.js/).

File src/Set.coffee

+# A set is a specialized collection which will never allow the same value to exist twice.
+Antifreeze.Set = class Set extends Collection
+	# Adds an element to the collection.
+	# Returns true if the element was added.
+	add: (obj) ->
+		return false if @contains obj
+		return super

File src/helpers/RivetsHelper.coffee

 		# Prepare data
 		data = convertData view.model()
 		# Bind.
-		Rivets.bind view.element(), data
+		if @rivetsView
+			console.log "clearing old rivets view"
+			@rivetsView.unbind()
+		@rivetsView = Rivets.bind view.element(), data
 
 	# Prepares the model data in a format consumable by Rivets.
 	# For all references, Rivets requires the initial level to be a plain object, thus single-level references are not