Permalink
Browse files

implement investment articles

  • Loading branch information...
1 parent 6bbaa9f commit 65559182c2316719ac0cc8379be2739ffea18356 @faust45 committed Feb 29, 2012
View
@@ -49,7 +49,7 @@ function initFroms(db) {
element.data('ujs:submit-button', null);
}
} else {
- method = element.attr('data-method');
+ method = element.attr('method');
url = element.attr('href');
data = null;
}
@@ -72,8 +72,19 @@ function initFroms(db) {
}
};
+
+ function toJSON(obj) {
+ return obj !== null ? JSON.stringify(obj) : null;
+ }
+
var data = element.toObject();
- db.save(data, options);
+ if (!url) {
+ db.save(data, options);
+ } else {
+ var data = element.serializeArray();
+ options.data = data;
+ $.ajax(options);
+ }
//$.ajax({
// url: url, type: method || 'GET', data: data, dataType: dataType, contentType: "application/json",
// // stopping the "ajax:beforeSend" event will cancel the ajax request
View
@@ -11,6 +11,12 @@
"method": "GET",
"query": {"view": "articles"}
},
+ {
+ "from": "articles",
+ "to": "_list/home/investment",
+ "method": "GET",
+ "query": {"view": "articles"}
+ },
{
"from": "/db/_view/*",
"to": "_view/*",
@@ -33,6 +39,10 @@
"from": "db/*",
"to": "../../*"
},
+ {
+ "from": "_session",
+ "to": "../../_session"
+ },
{
"from": "articles/:id",
"to": "_show/article/:id",
@@ -15,7 +15,7 @@
<div class="control-group">
<div class="controls">
<p class="help-block">Body</p>
- <textarea class="input-xlarge" name="body">{{body}}</textarea>
+ <textarea id="content-editor" name="body" cols="150" rows="10">{{body}}</textarea>
</div>
</div>
@@ -12,6 +12,7 @@
}
</style>
<link type="text/css" rel="stylesheet" media="screen" href="/css/bootstrap-responsive.css">
+ <link type="text/css" rel="stylesheet" media="screen" href="/css/jquery.wysiwyg.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="js/admin/core.js"></script>
@@ -24,6 +25,7 @@
<script src="js/routes.js"></script>
<script src="js/rails.js"></script>
<script src="js/bootstrap.js"></script>
+ <script src="js/nicEdit-latest.js"></script>
</head>
<body>
{{>top_menu}}
@@ -16,14 +16,19 @@
<link type="text/css" rel="stylesheet" media="screen" href="/css/docs.css">
<link type="text/css" rel="stylesheet" media="screen" href="/css/prettify.css">
-
-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
- <script src="_utils/script/jquery.couch.js"></script>
+ <script src="js/admin/core.js"></script>
+ <script src="js/mustache.js"></script>
+ <script src="js/jquery.toObject.js"></script>
+ <script src="js/form2js.js"></script>
+ <script src="js/admin/jquery.couch.js"></script>
+ <script src="js/admin/app.js"></script>
<script src="js/utils.js"></script>
<script src="js/routes.js"></script>
<script src="js/rails.js"></script>
<script src="js/bootstrap.js"></script>
+
+
<script>
$(function() {
$('#login-form').bind('ajax:complete', function(e, xhr, status) {
View
Binary file not shown.
View
@@ -0,0 +1,5 @@
+function(doc) {
+ if (doc.type == "Investment") {
+ emit(null, doc);
+ }
+}

0 comments on commit 6555918

Please sign in to comment.