Compare commits
10 Commits
7cece6bec4
...
4efddc271d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4efddc271d | ||
|
|
eec52c2630 | ||
|
|
8d59463f43 | ||
|
|
00fe1f1e5a | ||
|
|
fe82a1de21 | ||
|
|
3203bf13c4 | ||
|
|
1db9c19adf | ||
|
|
0f2827e0f4 | ||
|
|
35dbf61bb3 | ||
|
|
efe8f8d1b1 |
2
Capfile
2
Capfile
@ -16,7 +16,7 @@ require 'capistrano/rails/assets'
|
||||
require 'capistrano/rails/migrations'
|
||||
require 'capistrano/postgresql'
|
||||
#require 'capistrano/bower'
|
||||
require 'capistrano/delayed_job'
|
||||
# TODO enable job scheduler require 'capistrano/delayed_job'
|
||||
|
||||
|
||||
# Includes tasks from other gems included in your Gemfile
|
||||
|
||||
10
Gemfile
10
Gemfile
@ -38,7 +38,7 @@ group :development do
|
||||
gem 'capistrano-nginx', github: 'koenpunt/capistrano-nginx'
|
||||
gem "capistrano-db-tasks", require: false
|
||||
gem "capistrano-postgresql" #, '~> 4.2.0'
|
||||
gem 'capistrano3-delayed-job', '~> 1.0'
|
||||
# TODO enable job scheduler gem 'capistrano3-delayed-job', '~> 1.0'
|
||||
# required for ecdsa key
|
||||
gem "bcrypt_pbkdf", require: false
|
||||
gem "net-ssh", ">= 4.0.0", require: false
|
||||
@ -84,8 +84,8 @@ gem 'importmap-rails'
|
||||
gem 'turbo-rails'
|
||||
gem 'stimulus-rails'
|
||||
gem 'will_paginate'
|
||||
gem 'telegram-bot-ruby', '~> 1.0'
|
||||
gem 'delayed_job_active_record'
|
||||
gem 'daemons'
|
||||
# TODO enable telegram bots with job scheduler gem 'telegram-bot-ruby', '~> 1.0'
|
||||
# TODO enable job scheduler gem 'delayed_job_active_record'
|
||||
# TODO enable job scheduler gem 'daemons'
|
||||
|
||||
gem "activejob-status", "~> 1.0"
|
||||
# TODO enable job scheduler gem "activejob-status", "~> 1.0"
|
||||
|
||||
50
Gemfile.lock
50
Gemfile.lock
@ -60,9 +60,6 @@ GEM
|
||||
activejob (7.1.2)
|
||||
activesupport (= 7.1.2)
|
||||
globalid (>= 0.3.6)
|
||||
activejob-status (1.0.0)
|
||||
activejob (>= 6.0)
|
||||
activesupport (>= 6.0)
|
||||
activemodel (7.1.2)
|
||||
activesupport (= 7.1.2)
|
||||
activerecord (7.1.2)
|
||||
@ -126,9 +123,6 @@ GEM
|
||||
capistrano-rbenv (2.2.0)
|
||||
capistrano (~> 3.1)
|
||||
sshkit (~> 1.3)
|
||||
capistrano3-delayed-job (1.7.6)
|
||||
capistrano (~> 3.0, >= 3.0.0)
|
||||
daemons (~> 1.3)
|
||||
capistrano3-puma (6.0.0.beta.1)
|
||||
capistrano (~> 3.7)
|
||||
capistrano-bundler
|
||||
@ -162,7 +156,6 @@ GEM
|
||||
concurrent-ruby (1.2.2)
|
||||
connection_pool (2.4.1)
|
||||
crass (1.0.6)
|
||||
daemons (1.4.1)
|
||||
database_cleaner (2.0.2)
|
||||
database_cleaner-active_record (>= 2, < 3)
|
||||
database_cleaner-active_record (2.1.0)
|
||||
@ -171,11 +164,6 @@ GEM
|
||||
database_cleaner-core (2.0.1)
|
||||
date (3.3.4)
|
||||
debug_inspector (1.1.0)
|
||||
delayed_job (4.1.11)
|
||||
activesupport (>= 3.0, < 8.0)
|
||||
delayed_job_active_record (4.1.8)
|
||||
activerecord (>= 3.0, < 8.0)
|
||||
delayed_job (>= 3.0, < 5)
|
||||
devise (4.9.3)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
@ -193,25 +181,6 @@ GEM
|
||||
railties (>= 3.2)
|
||||
drb (2.2.0)
|
||||
ruby2_keywords
|
||||
dry-core (1.0.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
zeitwerk (~> 2.6)
|
||||
dry-inflector (1.0.0)
|
||||
dry-logic (1.5.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
dry-core (~> 1.0, < 2)
|
||||
zeitwerk (~> 2.6)
|
||||
dry-struct (1.6.0)
|
||||
dry-core (~> 1.0, < 2)
|
||||
dry-types (>= 1.7, < 2)
|
||||
ice_nine (~> 0.11)
|
||||
zeitwerk (~> 2.6)
|
||||
dry-types (1.7.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
dry-core (~> 1.0)
|
||||
dry-inflector (~> 1.0)
|
||||
dry-logic (~> 1.4)
|
||||
zeitwerk (~> 2.6)
|
||||
ed25519 (1.3.0)
|
||||
em-websocket (0.5.3)
|
||||
eventmachine (>= 0.12.9)
|
||||
@ -227,13 +196,6 @@ GEM
|
||||
railties (>= 3.0.0)
|
||||
faker (3.2.2)
|
||||
i18n (>= 1.8.11, < 2)
|
||||
faraday (2.7.12)
|
||||
base64
|
||||
faraday-net_http (>= 2.0, < 3.1)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-multipart (1.0.4)
|
||||
multipart-post (~> 2)
|
||||
faraday-net_http (3.0.2)
|
||||
ffi (1.16.3)
|
||||
formatador (1.1.0)
|
||||
friendly_id (5.4.2)
|
||||
@ -288,7 +250,6 @@ GEM
|
||||
hub (1.12.4)
|
||||
i18n (1.14.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
ice_nine (0.11.2)
|
||||
importmap-rails (1.2.3)
|
||||
actionpack (>= 6.0.0)
|
||||
activesupport (>= 6.0.0)
|
||||
@ -333,7 +294,6 @@ GEM
|
||||
mini_portile2 (2.8.5)
|
||||
minitest (5.20.0)
|
||||
multi_json (1.15.0)
|
||||
multipart-post (2.3.0)
|
||||
mutex_m (0.2.0)
|
||||
nenv (0.3.0)
|
||||
net-imap (0.4.7)
|
||||
@ -533,11 +493,6 @@ GEM
|
||||
stimulus-rails (1.3.0)
|
||||
railties (>= 6.0.0)
|
||||
stringio (3.1.0)
|
||||
telegram-bot-ruby (1.0.0)
|
||||
dry-struct (~> 1.6)
|
||||
faraday (~> 2.0)
|
||||
faraday-multipart (~> 1.0)
|
||||
zeitwerk (~> 2.6)
|
||||
temple (0.10.3)
|
||||
thor (1.3.0)
|
||||
tilt (2.3.0)
|
||||
@ -570,7 +525,6 @@ PLATFORMS
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
activejob-status (~> 1.0)
|
||||
bcrypt_pbkdf
|
||||
better_errors
|
||||
binding_of_caller
|
||||
@ -582,15 +536,12 @@ DEPENDENCIES
|
||||
capistrano-rails
|
||||
capistrano-rails-console
|
||||
capistrano-rbenv
|
||||
capistrano3-delayed-job (~> 1.0)
|
||||
capistrano3-puma (~> 6.0.beta)
|
||||
capybara
|
||||
capybara-screenshot
|
||||
ci_reporter_rspec
|
||||
coffee-rails
|
||||
daemons
|
||||
database_cleaner
|
||||
delayed_job_active_record
|
||||
devise
|
||||
devise_invitable
|
||||
dotenv-rails
|
||||
@ -641,7 +592,6 @@ DEPENDENCIES
|
||||
spring-commands-rspec
|
||||
sprockets
|
||||
stimulus-rails
|
||||
telegram-bot-ruby (~> 1.0)
|
||||
turbo-rails
|
||||
webdrivers
|
||||
will_paginate
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
//= link gems.js
|
||||
//= link jquery.js
|
||||
//= link libraries/swiped.min.js
|
||||
//= link_tree ../images
|
||||
//= link_directory ../stylesheets .css
|
||||
//= link_tree ../../javascript .js
|
||||
|
||||
1
app/assets/javascripts/libraries/swiped.min.js
vendored
Normal file
1
app/assets/javascripts/libraries/swiped.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(){function t(t,e){document.addEventListener(t,function(t){a._elems.forEach(function(i){for(var n=t.target;n;){if(n===i.elem)return i[e](t),!1;n=n.parentNode}return!1})})}function e(){var t=[].shift.call(arguments),e=arguments[0];for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}var i=window.navigator.msPointerEnabled,n={start:i?"MSPointerDown":"touchstart",move:i?"MSPointerMove":"touchmove",end:i?"MSPointerUp":"touchend"},o=function(){var t=window.getComputedStyle(document.documentElement,""),e=(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1];return"-"+e+"-"}(),s=function(){var t,e=document.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(t in i)if(void 0!==e.style[t])return i[t]}(),r={transition:o+"transition",transform:o+"transform"},h=function(){},a=function(t){var i={duration:200,tolerance:50,time:200,dir:1,right:0,left:0};t=e(i,t||{}),this.duration=t.duration,this.tolerance=t.tolerance,this.time=t.time,this.width=t.left||t.right,this.elem=t.elem,this.list=t.list,this.dir=t.dir,this.group=t.group,this.id=a.elemId++,this.onOpen="function"==typeof t.onOpen?t.onOpen:h,this.onClose="function"==typeof t.onClose?t.onClose:h,this.right=t.right,this.left=t.left,(t.right>0&&t.tolerance>t.right||t.left>0&&t.tolerance>t.left)&&console.warn("tolerance must be less then left and right")};a._elems=[],a.groupCounter=0,a.elemId=0,a.init=function(t){a.groupCounter++;var i=document.querySelectorAll(t.query),n=[];return delete t.query,[].forEach.call(i,function(i){var o=e({elem:i,group:a.groupCounter},t);n.push(new a(o))}),a._bindEvents(),a._elems=a._elems.concat(n),1===n.length?n[0]:n},a._closeAll=function(t){a._elems.forEach(function(e){e.group===t&&e.close(!0)})},a.prototype.transitionEnd=function(t,e){function i(){e.call(n),t.removeEventListener(s,i)}var n=this;t.addEventListener(s,i)},a.prototype.touchStart=function(t){var e=t.changedTouches[0];1===t.touches.length&&(this.touchId=e.identifier,this.x=e.pageX,this.y=e.pageY,this.startTime=new Date,this.resetValue(),this.list?a._closeAll(this.group):this.close(!0))},a.prototype.touchMove=function(t){var e=t.changedTouches[0];this.isValidTouch(t)&&(this.delta=e.pageX-this.x,this.dir=this.delta<0?-1:1,this.width=this.delta<0?this.right:this.left,this.defineUserAction(e),this.startSwipe&&(this.move(),t.preventDefault()))},a.prototype.touchEnd=function(t){this.isValidTouch(t,!0)&&this.startSwipe&&(this.dir*this.delta>this.tolerance||new Date-this.startTime<this.time?this.open():this.close(),t.stopPropagation(),t.preventDefault())},a.prototype.open=function(t){this.animation(this.dir*this.width),this.swiped=!0,t||this.transitionEnd(this.elem,this.onOpen),this.resetValue()},a.prototype.close=function(t){this.animation(0),this.swiped=!1,t||this.transitionEnd(this.elem,this.onClose),this.resetValue()},a.prototype.toggle=function(){this.swiped?this.close():this.open()},a.prototype.resetValue=function(){this.startSwipe=!1,this.startScroll=!1,this.delta=0},a._bindEvents=function(){return a.eventBinded?!1:(t(n.move,"touchMove"),t(n.end,"touchEnd"),t(n.start,"touchStart"),void(a.eventBinded=!0))},a.prototype.defineUserAction=function(t){var e=10,i=10;Math.abs(this.y-t.pageY)>i&&!this.startSwipe?this.startScroll=!0:Math.abs(this.delta)>e&&!this.startScroll&&(this.startSwipe=!0)},a.prototype.isValidTouch=function(t,e){var i=e?"changedTouches":"targetTouches";return t[i][0].identifier===this.touchId},a.prototype.move=function(){if(this.dir>0&&(this.delta<0||0===this.left)||this.dir<0&&(this.delta>0||0===this.right))return!1;var t=Math.abs(this.delta);t>this.width&&(this.delta=this.dir*(this.width+(t-this.width)/8)),this.animation(this.delta,0)},a.prototype.animation=function(t,e){e=void 0===e?this.duration:e,this.elem.style.cssText=r.transition+":"+r.transform+" "+e+"ms; "+r.transform+":translate3d("+t+"px, 0px, 0px)"},a.prototype.destroy=function(t){var e=this.id;a._elems.forEach(function(t,i){t.id===e&&a._elems.splice(i,1)}),t&&this.elem.parentNode.removeChild(this.elem)},window.Swiped=a}();
|
||||
@ -23,7 +23,8 @@ class BotsController < ApplicationController
|
||||
|
||||
def telegram_listen
|
||||
authorize @bot
|
||||
@bot.delay.telegram_listen
|
||||
# TODO enable bots with job scheduler
|
||||
# @bot.delay.telegram_listen
|
||||
redirect_to request.referrer
|
||||
end
|
||||
|
||||
|
||||
5
app/controllers/pages_controller.rb
Normal file
5
app/controllers/pages_controller.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class PagesController < ApplicationController
|
||||
before_action :skip_authorization
|
||||
def czechers
|
||||
end
|
||||
end
|
||||
2
app/helpers/pages_helper.rb
Normal file
2
app/helpers/pages_helper.rb
Normal file
@ -0,0 +1,2 @@
|
||||
module PagesHelper
|
||||
end
|
||||
@ -1,2 +1 @@
|
||||
import 'controllers'
|
||||
import "@hotwired/turbo-rails"
|
||||
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
||||
|
||||
@ -21,9 +21,7 @@ class Play < ActiveRecord::Base
|
||||
# TODO Pay out crypto
|
||||
# pay icypees rewards
|
||||
if !self.player.principal.nil?
|
||||
`dfx identity use 13rewards`
|
||||
player_wallet_balance = `dfx canister --network ic call es3he-kyaaa-aaaah-abzna-cai transfer '(principal "#{self.player.principal.strip}", 100000000:nat)'`
|
||||
`dfx identity use anonymous`
|
||||
player_wallet_balance = `dfx --identity 13rewards canister --network ic call es3he-kyaaa-aaaah-abzna-cai transfer '(principal "#{self.player.principal.strip}", 100000000:nat)'`
|
||||
end
|
||||
|
||||
self.game.save
|
||||
|
||||
@ -15,11 +15,9 @@ class Player < ActiveRecord::Base
|
||||
if stp.principal.nil?
|
||||
#TODO use principal
|
||||
if !soft_token.nil?
|
||||
if `dfx identity use #{soft_token}; echo $?`.to_i == 255
|
||||
if `dfx --identity #{soft_token} identity whoami; echo $?`.to_i == 255
|
||||
`dfx identity new #{soft_token} --disable-encryption`
|
||||
`dfx identity use #{soft_token}`
|
||||
@principal = `dfx identity get-principal`
|
||||
`dfx identity use anonymous`
|
||||
@principal = `dfx --identity #{soft_token} identity get-principal`
|
||||
stp.principal = @principal
|
||||
stp.save
|
||||
end
|
||||
|
||||
@ -3,26 +3,21 @@ class TelegramWallet < ActiveRecord::Base
|
||||
return self.icp_principal if self.icp_principal
|
||||
if self.icp_id.nil?
|
||||
if !self.telegram_id.nil?
|
||||
if `dfx identity use #{self.telegram_id}; echo $?`.to_i == 255
|
||||
if `dfx --identity #{self.telegram_id} identity whoami; echo $?`.to_i == 255
|
||||
`dfx identity new #{self.telegram_id} --storage-mode=plaintext`
|
||||
`dfx identity use #{self.telegram_id}`
|
||||
self.icp_principal = `dfx identity get-principal`.strip
|
||||
self.icp_id = `dfx ledger account-id`.strip
|
||||
`dfx identity use anonymous`
|
||||
self.icp_principal = `dfx --identity #{self.telegram_id} identity get-principal`.strip
|
||||
self.icp_id = `dfx --identity #{self.telegram_id} ledger account-id`.strip
|
||||
self.save
|
||||
else
|
||||
# Identity already exist
|
||||
self.icp_id = `dfx ledger account-id`.strip
|
||||
self.icp_principal = `dfx identity get-principal`.strip
|
||||
`dfx identity use anonymous`
|
||||
self.icp_id = `dfx --identity #{self.telegram_id} ledger account-id`.strip
|
||||
self.icp_principal = `dfx --identity #{self.telegram_id} identity get-principal`.strip
|
||||
self.save
|
||||
end
|
||||
end
|
||||
elsif
|
||||
`dfx identity use #{self.telegram_id}`
|
||||
self.icp_id = `dfx ledger account-id`.strip
|
||||
self.icp_principal = `dfx identity get-principal`.strip
|
||||
`dfx identity use anonymous`
|
||||
self.icp_id = `dfx --identity #{self.telegram_id} ledger account-id`.strip
|
||||
self.icp_principal = `dfx --identity #{self.telegram_id} identity get-principal`.strip
|
||||
self.save
|
||||
end
|
||||
return self.icp_principal
|
||||
@ -31,26 +26,21 @@ class TelegramWallet < ActiveRecord::Base
|
||||
return self.icp_id if self.icp_id
|
||||
if self.icp_principal.nil?
|
||||
if !self.telegram_id.nil?
|
||||
if `dfx identity use #{self.telegram_id}; echo $?`.to_i == 255
|
||||
if `dfx --identity #{self.telegram_id} identity whoami; echo $?`.to_i == 255
|
||||
`dfx identity new #{self.telegram_id} --storage-mode=plaintext`
|
||||
`dfx identity use #{self.telegram_id}`
|
||||
self.icp_principal = `dfx identity get-principal`.strip
|
||||
self.icp_id = `dfx ledger account-id`.strip
|
||||
`dfx identity use anonymous`
|
||||
self.icp_principal = `dfx --identity #{self.telegram_id} identity get-principal`.strip
|
||||
self.icp_id = `dfx --identity #{self.telegram_id} ledger account-id`.strip
|
||||
self.save
|
||||
else
|
||||
# Identity already exist
|
||||
self.icp_id = `dfx ledger account-id`.strip
|
||||
self.icp_principal = `dfx identity get-principal`.strip
|
||||
`dfx identity use anonymous`
|
||||
self.icp_id = `dfx --identity #{self.telegram_id} ledger account-id`.strip
|
||||
self.icp_principal = `dfx --identity #{self.telegram_id} identity get-principal`.strip
|
||||
self.save
|
||||
end
|
||||
end
|
||||
elsif
|
||||
`dfx identity use #{self.telegram_id}`
|
||||
self.icp_id = `dfx ledger account-id`.strip
|
||||
self.icp_principal = `dfx identity get-principal`.strip
|
||||
`dfx identity use anonymous`
|
||||
self.icp_id = `dfx --identity #{self.telegram_id} ledger account-id`.strip
|
||||
self.icp_principal = `dfx --identity #{self.telegram_id} identity get-principal`.strip
|
||||
self.save
|
||||
end
|
||||
return self.icp_id
|
||||
|
||||
@ -23,20 +23,16 @@ class User < ActiveRecord::Base
|
||||
if stp.principal.nil?
|
||||
#TODO use principal
|
||||
if !soft_token.nil?
|
||||
if `dfx identity use #{soft_token}; echo $?`.to_i == 255
|
||||
if `dfx --identity #{soft_token} identity whoami; echo $?`.to_i == 255
|
||||
`dfx identity new #{soft_token} --disable-encryption`
|
||||
`dfx identity use #{soft_token}`
|
||||
@principal = `dfx identity get-principal`
|
||||
@icid = `dfx ledger account-id`
|
||||
`dfx identity use anonymous`
|
||||
@principal = `dfx --identity #{soft_token} identity get-principal`
|
||||
@icid = `dfx --identity #{soft_token} ledger account-id`
|
||||
stp.principal = @principal
|
||||
stp.save
|
||||
end
|
||||
end
|
||||
elsif
|
||||
`dfx identity use #{soft_token}`
|
||||
@icid = `dfx ledger account-id`
|
||||
`dfx identity use anonymous`
|
||||
@icid = `dfx --identity #{soft_token} ledger account-id`
|
||||
end
|
||||
return @icid.strip
|
||||
end
|
||||
@ -46,11 +42,9 @@ class User < ActiveRecord::Base
|
||||
if stp.principal.nil?
|
||||
#TODO use principal
|
||||
if !soft_token.nil?
|
||||
if `dfx identity use #{soft_token}; echo $?`.to_i == 255
|
||||
if `dfx --identity #{soft_token} identity whoami; echo $?`.to_i == 255
|
||||
`dfx identity new #{soft_token} --disable-encryption`
|
||||
`dfx identity use #{soft_token}`
|
||||
@principal = `dfx identity get-principal`
|
||||
`dfx identity use anonymous`
|
||||
@principal = `dfx --identity #{soft_token} identity get-principal`
|
||||
stp.principal = @principal
|
||||
stp.save
|
||||
end
|
||||
@ -60,9 +54,7 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def icp_balance
|
||||
`dfx identity use #{soft_token}`
|
||||
balance = `dfx ledger --network ic balance`
|
||||
`dfx identity use anonymous`
|
||||
balance = `dfx --identity #{soft_token} ledger --network ic balance`
|
||||
return balance.strip
|
||||
end
|
||||
|
||||
|
||||
@ -31,11 +31,11 @@ class MetapursePolicy
|
||||
end
|
||||
|
||||
def show?
|
||||
true
|
||||
@user.admin? || @metapurse.user == @user || @metapurse.user == nil || @metapurse.is_private == false
|
||||
end
|
||||
|
||||
def data?
|
||||
true
|
||||
@user.admin? || @metapurse.user == @user || @metapurse.user == nil || @metapurse.is_private == false
|
||||
end
|
||||
|
||||
def create?
|
||||
@ -55,7 +55,7 @@ class MetapursePolicy
|
||||
end
|
||||
|
||||
def destroy?
|
||||
@user.admin? || @metapurse.user == @user
|
||||
@user.admin? || @metapurse.user == @user || @metapurse.user == nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@ -34,11 +34,11 @@ class TokenPolicy
|
||||
end
|
||||
|
||||
def create?
|
||||
@user.admin? || true
|
||||
@user.admin? || @user.signed_in?
|
||||
end
|
||||
|
||||
def new?
|
||||
@user.admin? || true
|
||||
@user.admin? || @user.signed_in?
|
||||
end
|
||||
|
||||
def add_existing?
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
- if policy(doodad).show?
|
||||
.doodad
|
||||
.doodad{class: "doodad-#{doodad.id}"}
|
||||
= doodad.body.html_safe
|
||||
- if policy(doodad).edit?
|
||||
= link_to 'Edit', edit_doodad_path(doodad)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
.original_flash_message_code
|
||||
- flash.each do |key, value|
|
||||
%div{class: "alert alert-#{key}"}
|
||||
= value.html_safe
|
||||
= value.to_s.html_safe
|
||||
|
||||
.react_flash_messages
|
||||
%div#flash_messages
|
||||
|
||||
@ -7,3 +7,27 @@
|
||||
.global-doodads
|
||||
%h1 Global Doodads
|
||||
= render collection: @global_doodads, partial: "doodads/doodad"
|
||||
|
||||
:javascript
|
||||
function destroyDoodad(doodad_id) {
|
||||
return fetch("/doodads/" + doodad_id, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json"
|
||||
}
|
||||
})
|
||||
.then(response => response)
|
||||
};
|
||||
// var s2 = Swiped.init({ query: '.bar li', list: true, left: 200, right: 200 });
|
||||
var global_doodad_swiped = Swiped.init({ query: '.global-doodads .doodad',
|
||||
list: true,
|
||||
left: 200,
|
||||
right: 200,
|
||||
onOpen: function() {
|
||||
var doodad_id = this.elem.className.split("-")[1];
|
||||
destroyDoodad(doodad_id)
|
||||
.then(results => console.log(results));
|
||||
this.destroy(true)
|
||||
}
|
||||
});
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
||||
<%= javascript_include_tag 'gems', 'data-turbolinks-track' => true %>
|
||||
<%= javascript_include_tag 'libraries/swiped.min.js', 'data-turbolinks-track' => true %>
|
||||
<%= javascript_importmap_tags %>
|
||||
<%= csrf_meta_tags %>
|
||||
<%= yield :head %>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
%tr
|
||||
%td
|
||||
= link_to metapurse.name, metapurse
|
||||
= "#{number_to_currency metapurse.total_usd} USD"
|
||||
-# = "#{number_to_currency metapurse.total_usd} USD"
|
||||
-# %td= metapurse.data
|
||||
- if policy(metapurse).update?
|
||||
-# %td= link_to 'Show', metapurse
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
$#{number_with_delimiter(value_amount)} USD
|
||||
- total_value += value_amount rescue 0
|
||||
- else
|
||||
- value = icpswap_pool_data_raw.split("record {").select{|pool| !pool.scan(canister_id).empty? && !pool.scan(icp_canister_id).empty? }[0].scan(/token0Price = [+-]?([1-9]\d*|0)(\.\d+)?/).join.to_f rescue nil
|
||||
- value = icpswap_pool_data_raw.split("record {").select{|pool| !pool.scan(canister_id).empty? && !pool.scan(icp_canister_id).empty? }[-1].scan(/token0Price = [+-]?([1-9]\d*|0)(\.\d+)?/).join.to_f rescue nil
|
||||
*
|
||||
= "$#{value.round(2)}"
|
||||
= icpswap_pool_data_raw.split("record {").select{|pool| !pool.scan(canister_id).empty? && !pool.scan(icp_canister_id).empty? }[0].scan(/token0Symbol = \"(.*)\"; /)[0][0] rescue nil
|
||||
|
||||
142
app/views/pages/czechers.html.haml
Normal file
142
app/views/pages/czechers.html.haml
Normal file
@ -0,0 +1,142 @@
|
||||
%h1{style: "padding-left: 0.5em;"} Czechers
|
||||
|
||||
:css
|
||||
.board {
|
||||
position: relative;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(8, 80px);
|
||||
grid-template-rows: repeat(8, 80px);
|
||||
gap: 1px;
|
||||
}
|
||||
.cell {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background-color: white;
|
||||
}
|
||||
.cell:nth-child(2n+1):nth-child(-n+8),
|
||||
.cell:nth-child(2n):nth-child(n+9):nth-child(-n+16),
|
||||
.cell:nth-child(2n+1):nth-child(n+17):nth-child(-n+24),
|
||||
.cell:nth-child(2n):nth-child(n+25):nth-child(-n+32),
|
||||
.cell:nth-child(2n+1):nth-child(n+33):nth-child(-n+40),
|
||||
.cell:nth-child(2n):nth-child(n+41):nth-child(-n+48),
|
||||
.cell:nth-child(2n+1):nth-child(n+49):nth-child(-n+56),
|
||||
.cell:nth-child(2n):nth-child(n+57):nth-child(-n+64) {
|
||||
background-color: black;
|
||||
}
|
||||
.czecher-piece {
|
||||
border-radius: 5em;
|
||||
width: 50px;
|
||||
outline: 2px #cccccc solid;
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.czecher-piece:active {
|
||||
outline: 2px #00ffff solid;
|
||||
}
|
||||
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 182px; top: 912px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 262px; top: 912px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 343px; top: 912px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 424px; top: 912px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 505px; top: 912px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 586px; top: 912px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 667px; top: 912px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 748px; top: 912px;"}
|
||||
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 182px; top: 993px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 262px; top: 993px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 343px; top: 993px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 424px; top: 993px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 505px; top: 993px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 586px; top: 993px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 667px; top: 993px;"}
|
||||
%img.czecher-piece{src:"/czech-logo-dip20.png", style: "left: 748px; top: 993px;"}
|
||||
|
||||
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 181px; top: 1480px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 261px; top: 1480px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 342px; top: 1480px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 423px; top: 1480px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 504px; top: 1480px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 585px; top: 1480px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 666px; top: 1480px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 747px; top: 1480px;"}
|
||||
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 181px; top: 1399px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 261px; top: 1399px; outline: 2px #00ffff solid;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 342px; top: 1399px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 423px; top: 1399px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 504px; top: 1399px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 585px; top: 1399px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 666px; top: 1399px;"}
|
||||
%img.czecher-piece{src:"/tendy-logo-icrc1.jpg", style: "left: 747px; top: 1399px;"}
|
||||
|
||||
|
||||
.board
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell{style: "background: #EFFA8D;"}
|
||||
.cell
|
||||
.cell{style: "background: #EFFA8D;"}
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell{style: "background: #B5FFFF;"}
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
.cell
|
||||
@ -15,6 +15,30 @@
|
||||
%p= link_to '+ New Doodad', new_doodad_path
|
||||
= render @doodads
|
||||
|
||||
:javascript
|
||||
function destroyDoodad(doodad_id) {
|
||||
return fetch("/doodads/" + doodad_id, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json"
|
||||
}
|
||||
})
|
||||
.then(response => response)
|
||||
};
|
||||
// var s2 = Swiped.init({ query: '.bar li', list: true, left: 200, right: 200 });
|
||||
var index_doodad_swiped = Swiped.init({ query: '#doodads .doodad',
|
||||
list: true,
|
||||
left: 200,
|
||||
right: 200,
|
||||
onOpen: function() {
|
||||
var doodad_id = this.elem.className.split("-")[1];
|
||||
destroyDoodad(doodad_id)
|
||||
.then(results => console.log(results));
|
||||
this.destroy(true)
|
||||
}
|
||||
});
|
||||
|
||||
-# #canisters
|
||||
= render @canisters
|
||||
- if current_user.signed_in?
|
||||
|
||||
4
bin/importmap
Executable file
4
bin/importmap
Executable file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require_relative "../config/application"
|
||||
require "importmap/commands"
|
||||
@ -1,7 +1,7 @@
|
||||
require_relative "boot"
|
||||
|
||||
require "rails/all"
|
||||
require 'telegram/bot'
|
||||
# TODO enable telegram bots with job scheduler require 'telegram/bot'
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
@ -20,6 +20,6 @@ module MyTendyZone
|
||||
#
|
||||
# config.time_zone = "Central Time (US & Canada)"
|
||||
# config.eager_load_paths << Rails.root.join("extras")
|
||||
config.active_job.queue_adapter = :delayed_job
|
||||
# TODO enable job scheduler config.active_job.queue_adapter = :delayed_job
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
set :application, "thirteen_tien_len_#{fetch(:stage)}"
|
||||
set :repo_url, 'git@pineapple.punked.us:Bort/thirteen-tien-len.git'
|
||||
set :repo_url, 'git@git.tendy.zone:Bort/thirteen-tien-len.git'
|
||||
|
||||
# If you want to import assets, you can change default asset dir (default = system)
|
||||
# This directory must be in your shared directory on the server
|
||||
|
||||
@ -1,9 +1,3 @@
|
||||
pin 'application', preload: true
|
||||
pin 'jquery'
|
||||
pin '@hotwired/turbo-rails', to: "turbo.js"
|
||||
pin '@hotwired/stimulus', to: 'stimulus.min.js', preload: true
|
||||
pin '@hotwired/stimulus-loading', to: 'stimulus-loading.js', preload: true
|
||||
pin_all_from 'app/javascript/models', under: 'models'
|
||||
pin_all_from 'app/javascript/controllers', under: 'controllers'
|
||||
pin_all_from 'app/javascript/subscriptions', under: 'subscriptions'
|
||||
pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
|
||||
# Pin npm packages by running ./bin/importmap
|
||||
|
||||
pin "application", preload: true
|
||||
|
||||
@ -2,4 +2,4 @@
|
||||
# Available options are: :status, :serialized_job, :exception
|
||||
# Default is [:status]
|
||||
#
|
||||
ActiveJob::Status.options = { includes: %i[status exception] }
|
||||
# TODO enable job scheduler ActiveJob::Status.options = { includes: %i[status exception] }
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
Rails.application.routes.draw do
|
||||
get 'pages/czechers'
|
||||
resources :metapurses do
|
||||
member do
|
||||
get 'data'
|
||||
|
||||
@ -79,7 +79,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_25_142502) do
|
||||
t.integer "sluggable_id", null: false
|
||||
t.string "sluggable_type", limit: 50
|
||||
t.string "scope"
|
||||
t.datetime "created_at"
|
||||
t.datetime "created_at", precision: nil
|
||||
t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true
|
||||
t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type"
|
||||
t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id"
|
||||
@ -295,7 +295,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_25_142502) do
|
||||
t.integer "invitations_count", default: 0
|
||||
t.string "soft_token"
|
||||
t.integer "win_count", default: 0
|
||||
t.integer "points"
|
||||
t.index ["email"], name: "index_users_on_email", unique: true
|
||||
t.index ["invitation_token"], name: "index_users_on_invitation_token", unique: true
|
||||
t.index ["invitations_count"], name: "index_users_on_invitations_count"
|
||||
|
||||
BIN
public/czech-logo-dip20.png
Executable file
BIN
public/czech-logo-dip20.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
BIN
public/tendy-logo-icrc1.jpg
Executable file
BIN
public/tendy-logo-icrc1.jpg
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 124 KiB |
15
spec/helpers/pages_helper_spec.rb
Normal file
15
spec/helpers/pages_helper_spec.rb
Normal file
@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the PagesHelper. For example:
|
||||
#
|
||||
# describe PagesHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
RSpec.describe PagesHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
11
spec/requests/pages_spec.rb
Normal file
11
spec/requests/pages_spec.rb
Normal file
@ -0,0 +1,11 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "Pages", type: :request do
|
||||
describe "GET /czechers" do
|
||||
it "returns http success" do
|
||||
get "/pages/czechers"
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
5
spec/views/pages/czechers.html.haml_spec.rb
Normal file
5
spec/views/pages/czechers.html.haml_spec.rb
Normal file
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "pages/czechers.html.haml", type: :view do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user