Permalink
Browse files

Bugfix: Cancel and close buttons in Publish dialog leaded to an excep…

…tion.
  • Loading branch information...
1 parent 2560cd0 commit 94c6f813f7359d49ff1a18d0c8426326c86dddbb @juanger committed Jan 13, 2009
View
@@ -10,12 +10,12 @@
PublishNib = "#{ENV["TM_BUNDLE_SUPPORT"]}/nibs/Publish.nib"
TextMode = ENV['TM_MODE'].scan(/Post — (.*)/)[0][0]
-blogger = GData::Blogger.new('')
-post = Post.new(ENV['TM_FILEPATH'], TextMode)
-
UI.dialog(:nib => PublishNib,
:parameters => {'blogs' => [], 'hideProgressIndicator' => false}) do |dialog|
+ blogger = GData::Blogger.new('')
+ post = Post.new(ENV['TM_FILEPATH'], TextMode)
+
##
# Authenticate
##
@@ -47,22 +47,22 @@
##
dialog.parameters = {'blogs' => blogs,'hideProgressIndicator' => true}
-
+ button = ""
dialog.wait_for_input do |params|
blog_id = params['returnArgument']
button = params['returnButton']
# puts params.inspect
- if blog_id
+ if button == 'Cancel'
+ puts "<h1>Publishing cancelled</h1>"
+ else
blogger.blog_id = blog_id
post.categories = params['categories']
- false
+ reply = blogger.entry(post.title, post.content, post.categories)
+ parser = Hpricot.parse(reply.body)
+ link = parser.at("//link[@rel='alternate']")
+ puts "<h1>Your post has been published!!</h1><br/><a href='#{link[:href]}'>#{link[:title]}</a>"
end
false
end # end of wait
-end # End of Publish dialog
-
-reply = blogger.entry(post.title, post.content, post.categories)
-parser = Hpricot.parse(reply.body)
-link = parser.at("//link[@rel='alternate']")
-
-puts "<h1>Your post has been published!!</h1><br/><a href='#{link[:href]}'>#{link[:title]}</a>"
+
+end # End of Publish dialog
Oops, something went wrong.
Binary file not shown.

0 comments on commit 94c6f81

Please sign in to comment.