Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changelog jQuery plugin #2

Closed
7 of 8 tasks
catalinmiron opened this issue May 15, 2014 · 4 comments
Closed
7 of 8 tasks

Changelog jQuery plugin #2

catalinmiron opened this issue May 15, 2014 · 4 comments

Comments

@catalinmiron
Copy link
Contributor

Need

The easiest way to integrate the changelog on the client-side is through a jQuery plugin

Deliverables

  • jQuery plugin that generates the DOM in a given container

The jQuery plugin will support the following options:

// Checks GitHub for new updates since last fetch
$('.changelog-container').changelog({
  // Label for the button the appears when you got updates, supports HTML
  buttonText: 'Click me, I got updates!',
  // Label for the reload button shown below the list, supports HTML
  reloadButtonText: 'Reload',
  // Position of the list around the button. E.g. if the button is placed 
  // on the bottom-right corner, you probably want the list to be positioned 
  // top-left or left-top
  listPosition: 'top-left',
  // Poll GitHub for new updates at every set number of seconds
  autoRefresh: 2,
  // GitHub repository to fetch issues from
  githubRepo: 'facebook/react',
  // Only show updates that have one of these labels
  githubLabels: ['bug', 'enhancement', 'feature'],
  // Payload for the GitHub issues endpoint 
  // https://developer.github.com/v3/issues/#list-issues
  githubParams: {
    // Only get issues from GitHub that have ALL of these labels
    // It's best to set a single label here, e.g. 'release', that's common
    // to all issues. For deeper filtering 'githubLabels' can be used
    labels: 'release'
  }
});

The jQuery plugin will have the following methods:

// Checks GitHub for new updates since last fetch
$('.changelog-container').changelog('checkForUpdates');

Solution

We need to have a container which in the first place will be empty, this will be targeted by the plugin.

Second, we need to make a jQuery plugin, which will have a method called checkForUpdates. Given options set by the user(see above), it will be able to poll GitHub and generate the appropriate DOM structure when issues are closed.
For a given repository (gitHubRepo) and a common label set under githubParams.labels this method will request the issues that were closed since a given timestamp. The timestamp will be set when the plugin is first initialized on a container and reset after new updates are received.

Prerequisites

TODO

  • create the skeleton for the plugin
  • create the default options for the plugin
  • apply custom options passed through changelog plugin
  • create a method which will append the changelog DOM to the container
  • create a method which will trigger click event on the button and toggle the list
  • create checkForUpdates method
  • create a destroy method that unbinds event listeners and removes the changelog DOM
  • add support for GitHub API

cc: @skidding @RadValentin

RadValentin added a commit that referenced this issue May 19, 2014
new LESS structure is stable, merging into master
RadValentin pushed a commit that referenced this issue May 20, 2014
RadValentin pushed a commit that referenced this issue May 20, 2014
RadValentin pushed a commit that referenced this issue May 20, 2014
HTML is now generated by plugin
@RadValentin
Copy link
Contributor

I build a simple demo to populate the list with dummy data

cc: @catalinmiron

@ovidiuch
Copy link
Contributor

Pull request?

RadValentin pushed a commit that referenced this issue May 20, 2014
RadValentin pushed a commit that referenced this issue May 22, 2014
@ovidiuch ovidiuch changed the title Changelog jQuery plugin main issue Changelog jQuery plugin May 22, 2014
ovidiuch added a commit that referenced this issue May 23, 2014
ovidiuch added a commit that referenced this issue May 23, 2014
ovidiuch added a commit that referenced this issue May 23, 2014
Rely on labels only
ovidiuch added a commit that referenced this issue May 23, 2014
ovidiuch added a commit that referenced this issue May 23, 2014
- Unbinds events
- Stops interval timer
- Removes DOM
ovidiuch added a commit that referenced this issue May 23, 2014
@RadValentin
Copy link
Contributor

Should we add an option to configure the text on the Reload button as well? I'm thinking that users might want to change it to something else like Relaunch or Refresh.

@ovidiuch
Copy link
Contributor

Sure. Maybe allow HTML here as well, to be able to insert any icon, etc.

On Fri, May 23, 2014 at 2:28 PM, Valentin Radulescu <
notifications@github.com> wrote:

Should we add an option to configure the text on the Reload button as
well? I'm thinking that users might want to change it to something else
like Relaunch or Refresh.


Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-43997654
.

Best regards,
Ovidiu Cherecheş

RadValentin added a commit that referenced this issue May 23, 2014
ovidiuch added a commit that referenced this issue May 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants