Skip to content

Commit

Permalink
Patch for more page native title display
Browse files Browse the repository at this point in the history
  • Loading branch information
classicalliu committed Jan 2, 2019
1 parent 46be507 commit 55c58ad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
6 changes: 6 additions & 0 deletions app/controllers/dapps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ def more
@dapps = @dapp_type.dapps.default_order.ransack(options).result
end

# GET /dapp/type/:id
def dapp_type
@dapp_type = DappType.find_by id: params[:id]
render json: { name: @dapp_type.name }
end

def mine
end

Expand Down
17 changes: 10 additions & 7 deletions app/javascript/src/pages/more/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ const main = ({ pname }) => {
titlebarNormal()
// const url = jsontable.more(location.href, currentLocale())
const url = location.protocol + "//" + location.host + location.pathname + ".json" + location.search
const pathnames = location.pathname.split('/')
document.title = decodeURI(pathnames[pathnames.length - 1])
const container = j('#id-container-dapplist')
j.get(url, (data) => {
const type = document.title
renderbyList(container, data, type)
bindTrackDapplist(container)
const arr = location.pathname.split("/")
const get_type_url = location.protocol + "//" + location.host + "/dapps/type/" + arr[arr.length - 1]
j.get(get_type_url, (resp)=> {
document.title = resp.name
const container = j('#id-container-dapplist')
j.get(url, (data) => {
const type = document.title
renderbyList(container, data, type)
bindTrackDapplist(container)
})
})
}

Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
resources :banners, only: [:index, :show]
# get 'info', to: 'dapps#info'
get 'more/:type_name', to: 'dapps#more', as: "more_dapps"
get 'dapps/type/:id', to: 'dapps#dapp_type', as: "dapps_type"
get 'mine', to: 'dapps#mine'
get 'history', to: 'dapps#history'

Expand Down

0 comments on commit 55c58ad

Please sign in to comment.