Put 'Share to Facebook' button back. Add additional logic to facebook controller to check for publish_actions permission.

References Coursemology/coursemology.org#179.
Ask for publish_actions if necessary when 'Share to Facebook' is invoked.

Move post badge logic out of Facebook controller and into js return script.
FB controller checks for publish_actions permission and passes that info down in an instance variable.

JS calls FB.login() if necessary to ask for the permission and checks if it was granted.
If yes, FB.api() is used to post the badge.
If not, nothing happens.

If permission is already granted, FB.api() is used to post the badge.

References Coursemology/coursemology.org#179.
Add counter to users table to track number of times publish_actions has been requested.

References Coursemology/coursemology.org#179.
Track number of times publish_actions has been asked for.

Facebook controller tracks number of times 'Share' button was clicked
when there was no permission to publish.

Popup achievement view stops showing the 'Share' button after permission
has been sought 3 times.

However, this approach is insufficient if the user grants permission on
the 3rd ask as the popup will no longer show the 'Share' button.

References Coursemology/coursemology.org#179.
Move publish_actions permission check to user model.

Permission check moved to user model so it is easier to access from
the achievement popup view. The check function takes the fb_access_token
from the session as a parameter.

Edit the Facebook controller to use that check function.
Reset the permission request counter when it has been used.

Modify achievement popup view to check if permission is already granted.
Only checking if the counter has reached the threshold is insufficient
as the button won't show subsequently if the user only grants permission
on the final request.

References Coursemology/coursemology.org#179.
Clean up debug messages and add comments.

Document edge case which can cause user to never be asked for
publish_actions again.

Remove console.log() messages from Javascript response.

References Coursemology/coursemology.org#179.
Autoremove empty test cases in coding questions
Rename pub_ask_ctr field to fb_publish_actions_request_count.

This field tracks the number of times the user was asked for publish_actions.
Disallow null values and set a default value of 0.
Rename class and filename accordingly.

References Coursemology/coursemology#179.
Rename references to pub_ask_ctr.

Fix places in achievement popup and Facebook controller which used
the old name of pub_ask_ctr. Change to fb_publish_actions_request_count.

Not allowing null values and setting the default to 0 also allows
the nil? checks to be removed.

References Coursemology/coursemology.org#179.
Move business logic of checking if FB button should be shown out of
achivement popup view and into user model.

Create a new user model function to check if FB share button for
achievements should be shown.

Use this new function in the popup's view.

References Coursemology/coursemology.org#179.
Remove redundant self in user model function.

References Coursemology/coursemology.org#179.
Merge remote-tracking branch 'upstream/development' into issue-179-enhance-permission
Initial commit of new rake task.
Complete rake task for adding existing achievements to FB as badges.

References Coursemology/coursemology.org#192.
Merge pull request #185 from fonglh/issue-179-enhance-permission

Issue 179 enhance permission request flow
Fix theme setting not functional bug
Check that facebook_obj_id in achievements does not exist before posting it to FB.

Only create a new 'badge' object on FB if its facebook_obj_id is currently NULL>

If not, assume the id is valid and don't do anything for this achievement.
As this task is primarily meant to be run once before achievements have
ever been posted to FB, nearly all of them should have facebook_obj_id is NULL.

References Coursemology/coursemology.org#192.
Add output statement for each created Facebook object.

Closes Coursemology/coursemology.org#192
Merge pull request #194 from fonglh/issue-192-add-achievements-to-fb

Add existing achievements to FB
Merge pull request #193 from wangqiang1208/bugfixing/theme

Fix theme setting not functional bug