| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 93e8ecd commit 68f3e22
10 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,7 @@ gem 'cancancan' | |||
| 29 | 29 | gem 'dusen' | |
| 30 | 30 | gem 'render_csv' | |
| 31 | 31 | gem 'demoji' | |
| 32 | + gem 'acts_as_paranoid', github: 'ActsAsParanoid/acts_as_paranoid' | ||
| 32 | 33 | ||
| 33 | 34 | gem "http_accept_language" | |
| 34 | 35 | gem 'rails-i18n' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,11 @@ | |||
| 1 | + GIT | ||
| 2 | + remote: git://github.com/ActsAsParanoid/acts_as_paranoid.git | ||
| 3 | + revision: ddcd1915179c73f74985af6bc8935321ca2fe08d | ||
| 4 | + specs: | ||
| 5 | + acts_as_paranoid (0.5.0.beta1) | ||
| 6 | + activerecord (~> 4.0) | ||
| 7 | + activesupport (~> 4.0) | ||
| 8 | + | ||
| 1 | 9 | GIT | |
| 2 | 10 | remote: git://github.com/alexandrz/omniauth-github.git | |
| 3 | 11 | revision: 37a030aa37659831ef80af21b5c7270fe1384b3c | |
@@ -316,6 +324,7 @@ PLATFORMS | |||
| 316 | 324 | ruby | |
| 317 | 325 | ||
| 318 | 326 | DEPENDENCIES | |
| 327 | + acts_as_paranoid! | ||
| 319 | 328 | airbrake (~> 3.1.15) | |
| 320 | 329 | bootstrap_form! | |
| 321 | 330 | cancancan | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,7 +14,7 @@ def search | |||
| 14 | 14 | return render :blacklisted | |
| 15 | 15 | end | |
| 16 | 16 | ||
| 17 | - if project = Project.find_or_create_by_url(params[:query]) | ||
| 17 | + if project = Project.find_by_url(params[:query]) | ||
| 18 | 18 | redirect_to pretty_project_path(project) | |
| 19 | 19 | else | |
| 20 | 20 | @projects = Project.search(params[:query].to_s).order(projects_order).page(params[:page]).per(30) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,6 @@ | |||
| 1 | 1 | class Project < ActiveRecord::Base | |
| 2 | + acts_as_paranoid | ||
| 3 | + | ||
| 2 | 4 | has_many :deposits # todo: only confirmed deposits | |
| 3 | 5 | has_many :tips, inverse_of: :project | |
| 4 | 6 | accepts_nested_attributes_for :tips | |
@@ -217,6 +219,15 @@ def self.find_or_create_by_url project_url | |||
| 217 | 219 | Github.new.find_or_create_project project_name | |
| 218 | 220 | end | |
| 219 | 221 | ||
| 222 | + def self.find_by_url project_url | ||
| 223 | + project_name = project_url. | ||
| 224 | + gsub(/https?\:\/\/github.com\//, ''). | ||
| 225 | + gsub(/\#.+$/, ''). | ||
| 226 | + gsub(' ', '') | ||
| 227 | + | ||
| 228 | + Github.new.find_project project_name | ||
| 229 | + end | ||
| 230 | + | ||
| 220 | 231 | # Removes inactive addresses from the wallet | |
| 221 | 232 | # Description: https://blockchain.info/api/blockchain_wallet_api | |
| 222 | 233 | def self.consolidate_addresses | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,7 +45,7 @@ def repository_info project | |||
| 45 | 45 | end | |
| 46 | 46 | ||
| 47 | 47 | def find_or_create_project project_name | |
| 48 | - if project = Project.find_by(host: "github", full_name: project_name) | ||
| 48 | + if project = find_project(project_name) | ||
| 49 | 49 | project | |
| 50 | 50 | elsif project_name =~ /\w+\/\w+/ | |
| 51 | 51 | begin | |
@@ -61,6 +61,10 @@ def find_or_create_project project_name | |||
| 61 | 61 | end | |
| 62 | 62 | end | |
| 63 | 63 | ||
| 64 | + def find_project project_name | ||
| 65 | + return Project.find_by(host: "github", full_name: project_name) | ||
| 66 | + end | ||
| 67 | + | ||
| 64 | 68 | def collaborators_info project | |
| 65 | 69 | (client.get("/repos/#{project.full_name}/collaborators") rescue []) + | |
| 66 | 70 | (client.get("/orgs/#{project.full_name.split('/').first}/members") rescue []) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,4 +39,6 @@ | |||
| 39 | 39 | %td= link_to t('.support'), pretty_project_path(project), class: 'btn btn-xs btn-success' | |
| 40 | 40 | = paginate @projects | |
| 41 | 41 | - else | |
| 42 | - .alert.alert-warning{role: 'alert'}= I18n.t('errors.project_not_found') | ||
| 42 | + .alert.alert-warning{role: 'alert'} | ||
| 43 | + = I18n.t('errors.project_not_found') | ||
| 44 | + = I18n.t('errors.opt_in_notice') | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,6 +18,7 @@ en: | |||
| 18 | 18 | sign_out: Sign out | |
| 19 | 19 | errors: | |
| 20 | 20 | project_not_found: Project not found. | |
| 21 | + opt_in_notice: Because of multiple complains to GitHub we had to make Tip4Commit opt-in for project maintainers and removed all projects that don't have deposits. If you want to add your project please create an issue at GitHub. | ||
| 21 | 22 | access_denied: Access denied | |
| 22 | 23 | can_assign_more_tips: "You can't assign more than 100% of available funds." | |
| 23 | 24 | wrong_bitcoin_address: Error updating bitcoin address | |
@@ -69,8 +70,8 @@ en: | |||
| 69 | 70 | projects: | |
| 70 | 71 | index: | |
| 71 | 72 | find_project: | |
| 72 | - placeholder: Enter GitHub project URL to add a project or any keyword to find it... | ||
| 73 | - button: Find or add project | ||
| 73 | + placeholder: Enter GitHub project URL or any keyword to find it... | ||
| 74 | + button: Find project | ||
| 74 | 75 | repository: Repository | |
| 75 | 76 | description: Description | |
| 76 | 77 | watchers: Watchers | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,8 +69,8 @@ ru: | |||
| 69 | 69 | projects: | |
| 70 | 70 | index: | |
| 71 | 71 | find_project: | |
| 72 | - placeholder: Введите GitHub адрес вашего проекта чтобы добавить его или ключевое слово для поиска... | ||
| 73 | - button: Найти или добавить проект | ||
| 72 | + placeholder: Введите GitHub адрес проекта или ключевое слово для поиска... | ||
| 73 | + button: Найти проект | ||
| 74 | 74 | repository: Репозиторий | |
| 75 | 75 | description: Описание | |
| 76 | 76 | watchers: Наблюдателей | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,5 @@ | |||
| 1 | + class AddDeletedAtToProjects < ActiveRecord::Migration | ||
| 2 | + def change | ||
| 3 | + add_column :projects, :deleted_at, :timestamp | ||
| 4 | + end | ||
| 5 | + end | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ | |||
| 11 | 11 | # | |
| 12 | 12 | # It's strongly recommended that you check this file into your version control system. | |
| 13 | 13 | ||
| 14 | - ActiveRecord::Schema.define(version: 20141029083726) do | ||
| 14 | + ActiveRecord::Schema.define(version: 20141112064004) do | ||
| 15 | 15 | ||
| 16 | 16 | create_table "collaborators", force: true do |t| | |
| 17 | 17 | t.integer "project_id" | |
@@ -54,6 +54,7 @@ | |||
| 54 | 54 | t.string "branch" | |
| 55 | 55 | t.boolean "disable_notifications" | |
| 56 | 56 | t.string "avatar_url" | |
| 57 | + t.datetime "deleted_at" | ||
| 57 | 58 | end | |
| 58 | 59 | ||
| 59 | 60 | add_index "projects", ["full_name"], name: "index_projects_on_full_name", unique: true | |
| Back | FazBrowse Home | New Git URL |
0 commit comments