Skip to content
Browse files

list twitter accounts for current user

  • Loading branch information...
1 parent 3d7cf95 commit e0b32923921a126a9773d4b6793c72df3e245eb3 @jchris committed
View
1 evently/profile/profileReady/selectors/div.tweet/pending_users/selectors/form/submit.js
@@ -1,5 +1,4 @@
function() {
- // check to see that the user exists
var widget = $(this)
, username = $("[name=username]", widget).val()
, app = $$(widget).app
View
3 evently/profile/profileReady/selectors/div.tweet/user_home/mustache.html
@@ -1,5 +1,6 @@
<h4>Welcome</h4>
<p>Your Twebz account is ready to go!
{{#admin}}
-Admin, <a href="#pending">setup pending users.</a>
+Admin, <a href="#pending">setup pending users</a> or
+<a href="#deploy">update user view code.</a>
{{/admin}}</p>
View
41 ...tly/profile/profileReady/selectors/div.tweet/user_home/selectors/a[href=#deploy]/click.js
@@ -0,0 +1,41 @@
+function() {
+ var widget = $(this)
+ , app = $$(widget).app
+ , twebz = app.require("lib/twebz").init(app.db.name)
+ ;
+ function updateDDoc(users) {
+ var user = users.pop()
+ , udb = $.couch.db(twebz.user_db(user))
+ ;
+ if (!user) {return;}
+ udb.openDoc("_design/twebz-private", {
+ success : function(doc) {
+ doc.views = app.ddoc["private"].views;
+ udb.saveDoc(doc, {
+ success : function() {
+ updateDDoc(users);
+ }
+ });
+ },
+ error : function() {
+ udb.saveDoc({
+ _id : "_design/twebz-private",
+ views : app.ddoc["private"].views
+ }, {
+ success : function() {
+ updateDDoc(users);
+ }
+ });
+ }
+ })
+ }
+ app.view("user-setup", {
+ success : function(resp) {
+ var users = [];
+ for (var i=0; i < resp.rows.length; i++) {
+ users.push(resp.rows[i].value);
+ };
+ updateDDoc(users);
+ }
+ })
+};
View
2 notes.txt
@@ -50,6 +50,8 @@ now check to see if user needs setup:
link twitter accounts and save creds in private-db
prompt to run twebz-node script
(can we use externals API to provide uuid to node script?)
+
+
link twitter account(s) to couchdb account
user stores a start-link-account document to the twebz db
in state "request"
View
5 private/views/twitter-accts/map.js
@@ -0,0 +1,5 @@
+function(doc) {
+ if (doc.state == "has_access" && doc.access_params) {
+ emit(doc.access_params.screen_name, doc.access_params.user_id);
+ }
+};

0 comments on commit e0b3292

Please sign in to comment.
Something went wrong with that request. Please try again.